Hi Everyone,

Can you tell me how to build a PDF Document in memory. If I use
ByteArrayOutputStream to create OutputStream and pass this outputStream to
PdfWriter.getInstance, then I can have a PDF Document in memory. However,
after building the document, I have to call document.close() and in the
tutorial, It said calling document.close() will flush and close the
outputstream to which the writer is writing. I have tried to get the PDF
Document from my ByteArrayOutputStream  before call document.close() but
what I get is an uncompleted document.

(Concat.java)

...
Document document = new Document(reader.getPageSizeWithRotation(1));
ByteArrayOutputStream pdfOutputStream = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, pdfOutputStream);

....

byte [] tempPDF = pdfOutputStream.toByteArray(); 
document.close(); // this will close my ByteArrayOutputStream (???)


Do you have any idea,

Thanks

Liem





-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to