I currently have code (posted elsewhere) that does the following: 1. creates a PdfReader and a ByteArrayOutputStream to feed to a PdfStamper; I get the AcroForm fields, setFieldCache(), and fill them in with form.setField(name,value).
2. outside of that, I create a PdfSmartCopy as my output document; I create one of the above ByteArrayOutputStreams per record, then use PdfSmartCopy.addPage() to add the result of getImportedPage on the PdfSmartCopy object. This works, but it eats 3M of heap space per record. I've read several parts of The Book several times, and I can tell there's a much more efficient way to do this. I understand that I can create a PdfTemplate document, then reuse it for each page; I also understand that I can read the Pdf form that I have and extract each field's bounding rectangle, then use that to put text from my data records in place. The examples in the book for this use the iText XML parser, and all the talk about the XML stuff loses me. I understand about creating a non-printing layer in onOpenDocument(), and about putting what I guess is a reference to it using PdfContentByte.addTemplate() in onStartPage(). One thing I don't understand is how to go about adding content to the document to trigger these events. I'm not adding the form, I'm not adding text. Do I execute "writer.setPageEmpty(false); document.newPage()", and then do all the adding of stuff in the onStartPage()? The example in Chap 14 shows onStartPage() as doing "cd.beginLayer(not_printed); cd.addTemplate(paper, 0, 0); cd.endLayer();" In the scenario above, is this where I would put beginText ... endText calls to put the text from my records into place? -- View this message in context: http://www.nabble.com/one-Acroform%2C-multiple-sets-of-data-tp16315795p16315795.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ 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/
