I need to add a "disclosure" page to the end of each PDF I produce. 

Currently I'm doing this:

//move to new page
Static final PdfReader disclosure = new PdfReader("disclosure.pdf")
...
doc.newPage();
PdfImportedPage page = writer.getImportedPage(disclosure, 1);
Image image = Image.getInstance(page);
image.setAbsolutePosition(0, 0);
canvas.addImage(image);

I'm doing this 1000s of times, so I'm wondering if there's a better/more
efficient way.  Seems like these three lines:

PdfImportedPage page = writer.getImportedPage(disclosure, 1);
Image image = Image.getInstance(page);
image.setAbsolutePosition(0, 0);

should only need to be done once, but it seems like the only way to
"import" a page is to use the writer of the PDF I'm currently writing.
Is there no way to create an image or template instance once and then
append it to multiple PDFs created in a loop?

Something like:

Image disclosure = //get disclosure page
For(Long account:accounts){
        Byte[] pdf = // generate pdf for account
        pdf = addDisclosure(disclosure, pdf);
}


Jason Berk

This is a transmission from Purdue Federal Credit Union (Purdue Federal) and is 
intended solely for its authorized recipient(s), and may contain information 
that is confidential and or legally privileged. If you are not an addressee, or 
the employee or agent responsible for delivering it to an addressee, you are 
hereby notified that any use, dissemination, distribution, publication or 
copying of the information contained in this email is strictly prohibited. If 
you have received this transmission in error, please notify us by telephoning 
(765)497-3328 or returning the email. You are then instructed to delete the 
information from your computer. Thank you for your cooperation.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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

Reply via email to