I have some binary data in memory (which represents a PDF file). What I’d like to be able to do is to point the standard .NET browser control directly to this data. For example:
myLib mylib = new myLib();
object vbyt = mylib.GetPDFDocument();
webBrowser1.data = vbyt;
Is this possible, or do I need to save the PDF to a file and read from there?
EDIT:
I believe that the following should do what I need, but it just spits out garbage - can anyone tell me why / a way to get this to work?
byte[] vbyt = (byte[])mylib.GetPDFDocument();
MemoryStream ms = new MemoryStream();
ms.Write(vbyt, 0, vbyt.Length);
ms.Position = 0;
//conetent type = "application/pdf";
webBrowser1.DocumentStream = ms;