COnvert current html page to io.memorystream

bradwest1217

New member
Joined
Aug 18, 2006
Messages
3
Programming Experience
Beginner
Hello,
I want to convert the current active html page (With all the data in it) to a io.memorystream. I just need to fill in this blank I have:

Dim oStream As New IO.MemoryStream
' Fill oStream with current html page ?????????????????????????????????????
Dim path As String = Server.MapPath("~/printing")
If (Not IO.Directory.Exists(path)) Then
IO.Directory.CreateDirectory(path)
End If
path &= "\PageStream"
path &= Session.LCID
path &=
".pdf"
If IO.File.Exists(path) Then
IO.File.Delete(path)
End If
Dim fs As System.IO.FileStream = IO.File.Open(path, IO.FileMode.Create, IO.FileAccess.Write, IO.FileShare.ReadWrite)
fs.Write(oStream.ToArray(), 0, oStream.ToArray.Length)
fs.Close()
Dim displaypath As String = "printing/PageStream"
displaypath &= Session.LCID
displaypath &=
".pdf"
'open the report in new window
Response.Write("<script language=javascript>window.open('" & displaypath & "','new_Win','menubar=no,location=no,resizable=yes,scrollbars=yes,status=no');</script>")

I can do this using Crystal reports with a export funtion which converts the report to a io.memorystream so I know the code works. I just need to get the current page as a io.memorystream. I have tried using Response.OutputStream, but no luck.

What I want to do is save the current html page with data to a pdf file and display it so they can print it or save it.

Thanks
Brad West
 
Back
Top