Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start process from stream

Tags:

c#

stream

process

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

like image 290
Alexandre Pepin Avatar asked Jan 28 '10 20:01

Alexandre Pepin


3 Answers

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.

like image 158
David M Avatar answered Sep 22 '22 22:09

David M


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).

like image 34
Oded Avatar answered Sep 22 '22 22:09

Oded


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.

like image 45
Tim Jarvis Avatar answered Sep 24 '22 22:09

Tim Jarvis