Question : VB.net WebBrowser read from Stream

Good evening,
Ive got a problem where I need to show a PDF file, but I dont want to put the file on the hard drive then open it.

Ive looked into the posibility of using the Adobe Reader plugin, but cant find out how to get it to read from a stream like Ive got working for my JPG images. My first attempt was to convert all the PDF files to JPG images, and import them, then put the images into my viewer as streams, but I cannot find any free PDF to JPG converters that I can code in VB.net.

So my current idea is to use the webbrowser component, and change the header values and source to a PDF, only problem being, I have NO idea if I can get the webbrowser control to read from a file stream.

Ive attached my code so far, but when I get to the webbrowser.loadFile = stm, VB falls over :-(

The code for attaching works, as I can direct the stream to save the file to the hard drive, and can open the file fine.

Any ideas would be extreamly greatfully recived!

Thank you
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Dim dbPath As String = Application.StartupPath & "\bob.db"
Dim con As New SQLiteConnection("Data Source=" & dbPath & ";UTF8Encoding=True;Version=3")
Dim da As New SQLiteDataAdapter("Select * From tbl ", con)
Dim MyCB As New SQLiteCommandBuilder(da)
Dim ds As New DataSet("MyImages")
da.Fill(ds, "MyImages")
con.Close()
Dim myRow As DataRow
myRow = ds.Tables("MyImages").Rows(ds.Tables("MyImages").Rows.Count - 1)
Dim stuff() As Byte = myRow("t")
Dim stm As New MemoryStream(stuff)
webbrowser1.loadfile = stm '<-FAILS HERE

Answer : VB.net WebBrowser read from Stream

When I figure that out, I will be a happy, happy man, since I have been researching this problem for a while (off and on).  I haven't had any time to see if I could make something of the CodeProject example, using the pluggable asynchronous protocol.  For this particular problem, now, I just write the .pdf stream to a temporary file, and then use the file association to open the file with the Acrobat Reader, but that is not the best solution.
Random Solutions  
 
programming4us programming4us