Bruno Lowagie <bruno <at> lowagie.com> writes: > > Gatewood, Paul (RSIS) wrote: > > I have a "template" pdf with 5 pages. > > > > The first 4 pages have "normal" form fields. By calling them > > "normal" I mean The runtime values for all such fields are all short > > enough to fit within the corresponding fields. > > > > Page 5 has 1 large form field, the value of which may need more > > space than is available on page 5. If this happens, the final > > output PDF should contain additional pages (6, 7, etc.) with > > whatever "overflow" text from this long text value did not fit on > > page 5. > > > > What I may not have made clear earlier is that page 5 of the > > template, in addition the large form field, also contains some > > "normal" form fields. These appear at the top of most of the pages > > of the template (including page 5). > > OK, then maybe you should do it in two passes. > First use PdfStamper to fill out and flatten all the fields > EXCEPT the large one on page 5. Don't forget to retrieve > the coordinates of the large field. Close the stamper. > > Now you have a PDF template that is almost completely filled in > (as described in chapter 2: this form doesn't need to be stored > on the file system; it can be stored in memory as a byte array). > Use this form to create a new PdfReader and PdfStamper object. > Use the coordinates retrieved earlier to add the content on > page 5. The rest is similar to what you're already doing now, > with as main difference that the 'normal' fields on page 5 are > no longer acrofields, but real content (and part of the imported > page). > > An alternative might be to add all the fields on page 5 > the same way you're adding the large field. However I think > this will take more processing time and result in a slightly > larger file size. > -------------------------------------------------------------------------
Thanks Bruno -- I will try the approach of stamping the fields on page 5 during the first pass, so the "normal" field values have already been filled out when I later import page 5 for the overflow of the large field. If (when!) I get this working, another thing I will need to do is add "page X of Y" information to each page. In the past, this was hard-coded in the template, as the final documents were always 5 pages long. Now, of course, this needs to be dynamic. I will use the examples in Ch. 14 as well as search this list for help on this, but if you have any recommendations, based on this particular situation, I would be grateful. ------------------------------------------------------------------------- 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/
