Let’s say I have two PDF templates created with Adobe Acrobat, which are both single-page, 8.5×11 documents. The first template (A.pdf) has content for the top half of the page. The second template (B.pdf) has content for the bottom half of the page. (It just so happens the content in both templates does not “overlap” each other.)
I would like to use iText to take these two templates and create a single, “merged” template from it (C.pdf) that is only a single page (with A.pdf’s content on the top half and B.pdf’s content on the bottom half).
(I do not want to “merge” these two files into a 2-page document. I need the final product to be a single page.)
I will be running iText in a servlet environment (Tomcat 6) but I don’t think that makes a difference to the answer.
Is this possible?
I got help from Mark Storer on the iText mailing list. The solution is to get
PdfTemplateobjects for each file, and then use theaddTemplate()method to add them together, e.g.: