Marc Font wrote: > I'm generating a PDF and before close the document, so before send the > HttpServletResponse, I need to add an existing PDF in the end of the document.
You are generating a PDF with PdfWriter, right? So you have this writer object: PdfWriter writer = PdfWriter.getInstance(document, baos); At the end of the document, before you do document.close(); you should create a PdfReader object that is able to read the existing document. Ask the reader for the page size of the first page of this existing document, change the page size of the document you are generating accordingly, and then do document.newPage(); Use PdfWriter.getImportedPage and add the PdfImportedPage to the direct content. If you want to add more than one page from the existing PDF, repeat this process (change page size, do new page, add an imported page). There are other ways to do it that may be better or worse; it all depends on your exact requirements. > I've been trying to figure out how to do it with both examples of how to > concatenate documents and don't get it. This is actually a very funny remark: you tried figuring out how to do it with 'both examples'. There are plenty of examples that explain how to do this on the net, it is very hard to guess which two examples you tried. br, Bruno ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
