Jeff Jacobs wrote: > I am trying to add a table to an existing 1-page PDF (the existing PDF > has an AcroForm header and footer that I am populating). I want to add a > table to the middle of the page, and if the table gets too long, it will > start a new page (With the existing PDF document copied to the new page > - I need the headers & footers on every page). > > I believe I will have to position the table w/ coordinates (below the > header), and evaluate its height before adding each row. (When it gets > too long, I should start a new page, copy the existing document to the > new page, and start a new table). > > I am having trouble juggling PDFStamper, PDFReader & PDFWriter while > keeping the file in memory (this is for a web application and I don't > want to save any files to disk).
A similar (but more complex) situation was solved in this mailing list thread: http://article.gmane.org/gmane.comp.java.lib.itext.general/28375 What I would do is: - create a new document - create a new PdfWriter for this new document - open the document - create the existing PDF with PdfReader - get the field positions - get a PdfImportedPage for the writer - create a Page Event that adds this PdfImportedPage and writes the header/footer data at absolute positions. - add an instance of this page event to the writer - now create a PdfPTable and add it to a ColumnText object. - define the column so that its content fits the middle of the page. - perform go() and newPage() as many times as needed. - close the document. There are other ways to do it, but this should work. br, Bruno ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ 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/
