tags:

views:

162

answers:

4

I have a memory stream that contains a PDF file.

Is it possible to view the PDF without saving it to the hard disk ? Process.Start() only takes a path and not a stream.

Thank you

+3  A: 

Only by implementing your own pseudo-file system in C#, somehow mounting this as a disk in Windows, and having it intercept the file open and stream the contents of your MemoryStream. Absolutely 100% certainly not worth the effort.

David M
A: 

If there is, process.Start won't be the way, but I'd risk guessing that there isn't. Unless there's a specific PDF API that allows that somehow (I doubt) I'd save it to disk.

Yossi Dahan
+1  A: 

You can create a RAM drive and write the stream to it, this way you are still keeping it all in ram (assuming the disk operations are what worries you).

Oded
+1  A: 

Sure, this is certainly possible. Just not via Process Start and Adobe Reader (I assume you are invoking Adobe or something similar)

If you are using .NET or Java you simply need to find a PDF viewer component, there are lots to choose from, google will give you plenty of links, Gnostice has a good one, but its expensive. Once you find a suitable control, view the PDF directly from your app.

Tim Jarvis
i was about to suggest something like this. Find a PDF viewing component (if you can automate Reader itself, all the better) and see if it can load from an IStream.
Ian Boyd