Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# PDF
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 10-Aug-10 6:20am
Edited 10-Aug-10 21:22pm
v2
Comments
Sandeep Mewara at 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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 )
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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()
 
Smile | :)
  Permalink  
Comments
Ryan McBeth at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 11 Aug 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100