I want to use the WebBrowser control to display several files. But it is necessary to rename, remove the files after the WebBrowser control shows them. The problem is, that the files are locked until the WebBrowser is set to display another or no file.
Is there a way of forcing the WebBrowser to cache the file and release it immediatly after loading?
Now I created a memory stream from the file and pass it to the WebBrowser control.
using (var fileStream = new FileStream(source, FileMode.Open, FileAccess.Read, FileShare.Read))
{
fileMemoryStream = new MemoryStream();
fileStream.CopyTo(fileMemoryStream);
}
fileMemoryStream.Position = 0;
webBrowser.NavigateToStream(fileMemoryStream);
But now I don't see a pdf document but I see the pdf as ASCII code.
"%PDF-1.2 %ÈÇÐÄF 4 0 obj << /Type /Outlines /Count 0 >> endobj 5 0 obj......."
Is there any way to attach the program type from the file to the stream to show the PDF?