You are on the right track referring to the text, but there is also a plethora
of examples on the iText web site and a simple Google search will also reveal
some ideas. You can also search the archives for this list.
Basically, you need to gather all of your documents from the database like you
are. Convert each of those into a ByteArrayOutputStream rather than a
FileOutputStream when you create your PdfReaders. You can collect these
streams in an array if there are not too many, or set up your loop to retrieve
a document from the database and then merge it to your final PdfCopy. Each
time you create a new document from the database, use a PageEvent to stamp the
page numbers. You probably do not want to use a page event on the final
PdfCopy if you want to preserve the individual document page numbers you just
created and stamped.
The following is just a snippet of code to think about and is not quaranteed to
work...
PdfReader reader = reader created from document retrieved from the
database...(put this in an array and loop through readers using code below?)
Document document = new Document();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfCopy finalPDF = new PdfCopy(document, baos);
for(int page = 0; page < reader.getNumberOfPages; ) {
finalPDF.addPage(finalPDF.getImportedPage(reader, ++page));
}
Hope this helps.
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
iText-questions@lists.sourceforge.net
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