Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a byte array(of a pdf file)stored in my database and I want to open it as a pdf file and embed it in iframe or any other panel and display it, without saving it on localdisk. How can I do it?
Posted
Updated 10-Aug-10 20:22pm
v2
Comments
Sandeep Mewara 10-Aug-10 12:07pm    
How do you expect it to do? If you dont want it to be saved on disk or in memory then where will the conversion take place?

There is something on the Acrobat forum about this. The example is in C++ however and it isn't all that easy. But maybe it can get you somewhere.

http://forums.adobe.com/message/2018299#2018299[^]

http://pastebin.com/f3cb079f8[^]

Good luck!
 
Share this answer
 
The big question is, what on earth is this byte array in the first place ? Is it an image file ? Is it text ? Either way you need some sort of PDF library to do this, but your question is harder to answer than most PDF questions, because the answer depends on what data you're working with, to a degree ( it will still be 'find a library and buy it, tho )
 
Share this answer
 
To do this you need ITextSharp.

Just download it and use to create PDF document:

Document myDocument = new Document(PageSize.LETTER);
PdfWriter.GetInstance(myDocument, new FileStream("mydocument.pdf", FileMode.Create));
myDocument.Open();
myDocument.Add(new Paragraph(Encoding.UTF8.GetString(bytes)));
myDocument.Close()


:)
 
Share this answer
 
Comments
Ryan McBeth 10-Aug-10 16:29pm    
As soon as I saw this posted I thought if iTextSharp. I use it at work to create professional receipts with images. I agree with Abhishek.
Ryan McBeth
Create a RAM-drive at runtime, save the bytes to that virtual drive with a PDF extension, then have Adobe Reader open that virtual file.

Either that, or create your own viewer or find a PDF viewer that accepts memory content or a stream.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900