Load binary data into WebBrowser Control?


L

leslie eldrige

Dear All,

I want to distribute just my EXE file without any document files or
settings. So I created a PDF document file and stored it into my resources.
The idea is to display it directly from main application using WebBrowser
control. I am using following snippet to reload my PDF document from
resources:

Dim myAssembly As Assembly = Assembly.GetExecutingAssembly()
Dim PdfResourceName As String = String.Format("{0}.{1}",
myAssembly.GetName().Name, "MyPdfFile.pdf")
Dim PdfStream As Stream =
myAssembly.GetManifestResourceStream(PdfResourceName)

Me.WebBrowser1.DocumentStream = PdfStream

The problem is that the WebBrowser control shows to me just binary data! I
am sure that I should also set the MIME Type to "application/pdf", but how I
can do it? The property "DocumentType" from WebBrowser is read only!

How can I set the MIME type by WEbBrowser or if it is not possible, then how
can I display my PDF file directly from resources without saving on the local
hard disk?

Thanks
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top