Thanks for the response. Once I figured out how to create the document
in memory, I passed it from subroutine to subroutine.
I appreciate the help.
From: McGee, Edwin F. Sr. [mailto:[email protected]]
Sent: Friday, October 14, 2011 10:04 AM
To: [email protected]
Subject: Re: [iText-questions] Subject: Inserting external PDF documents
Generic disclaimer to read the book and/or look at the samples online.
Then you could also create a PdfCopy which is very similar to a
PdfWriter. Whether an additional file is created or not depends upon
the output stream you select. If you use a new FileOutputStream then
you will need to specify a destination for the physical file. If
instead you use a BinaryOutputStream (let's call it baos) then your
output will only reside in memory. You can then create a PDF from this
BinaryOutputStream with new PdfReader(baos.toByteArray()). Your PDF
will exist in memory and can be concatenated with other PDFs.
In short, create a PdfCopy of your file from the database using a
BinaryOutputStream. Then append the additional PDFs to this PdfCopy:
PdfReader reader = other PDF to append.
PdfCopy copy = new PdfCopy(document, baos);
for (int page = 0; page < reader.getNumberOfPages(); ) {
copy.addPage(copy.getImportedPage(reader, ++page));
}
Keep the same copy and repeat above until all PDFs have been appended.
Then close your baos and either send it back to the database or create a
physical file.
Thanks.
Ed McGee
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php