Paul Gatewood wrote:
> In case this might help anyone else, here is the current
> code which does all:

Writing examples like this takes a tremendous amount of time
(I know because I have written hundreds of them), so I really
like it when people post feedback like this; I'm sure it will
prove useful for further reference!

Some minor remarks:
>     float[] sowFieldPositions = form.getFieldPositions("long_sow");
>     if ( sowFieldPositions == null ) {
>         System.err.println("no field positions found for long_sow");
>         System.exit(1);
>     } else if (sowFieldPositions.length != 5) {
>         System.err.println("unexpected number of values for long_sow field
> positions: " + sowFieldPositions.length);
>         System.exit(1);
>     }
>     float llx = sowFieldPositions[1];
>     float lly = sowFieldPositions[2];
>     float urx = sowFieldPositions[3];
>     float ury = sowFieldPositions[4];

You do a lot of checking here, which is a good thing,
but you forgot to check sowFieldPositions[0] (which is
the page number of the page containing the field).

Maybe you can store the value in a variable, and use it in this line:
>     PdfImportedPage sowPage = stamper2.getImportedPage(reader2,5);

like this: int pagenumber = (int)sowFieldPositions[0];
PdfImportedPage sowPage = stamper2.getImportedPage(reader2, pagenumber);

You could also use the actual size of page 5
instead of hardcoding the page size:

Rectangle pagesize = reader.getPageSizeWithRotation(pagenumber);
stamper2.insertPage(++pageCt, pagesize);

Of course these are just details...
It was nice working with you.
We did a good job ;-)
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/

Reply via email to