I need to generate a multi-page PDF where each page is based upon a
specific template. I used
http://itext.ugent.be/articles/eid-pdf/test/BatchFormFill.java as a
reference.

It works, but only to an extent. My PDF template has fields such as
LANGUAGE_1, LANGUAGE_2, CELL_NUMBER_1, CELL_NUMBER_2 and so on.

The problem: All my fields are populated except for the most
right-most ones in my template.  My template is in landscape-mode (A4)
so that may have something to do with it.

To find the coordinates for my field I used the following (apart from
this, my example is exactly the same as BatchFormFill as mentioned
above. Also note that my Document() object is also made to be in
landscape-mode):

for (int i = 0; i < keys.length; i++)
{
            List<FieldPosition> positions = fields.getFieldPositions(keys[i]);
            coordinates[i] = new Rectangle (
                    positions.get(0).position.getBottom(),
                    positions.get(0).position.getRight() + 5,
                    positions.get(0).position.getLeft(),
                    positions.get(0).position.getTop() + 5);
}

The reason I am using a List<FieldPosition>, is that the
getFieldsPositions() no longer returns a float[] as in the
BatchFormFill example. (The API must have changed at some point.)

Also note that I am using the strange order of "getBottom, getRight,
getLeft, getTop" to create the coordinate-Rectangle.  I tried
"getLeft, getBottom, getRight, getTop" first but then nothing
displayed, so I went for this order.

   My one field called "LANGUAGE_1" is found at coordinates: 354.334,
137.165, 21.555, 371.664 (LEFT_X, LEFT_Y, RIGHT_X, RIGHT_Y) and is
correctly populated. However, the field "CELL_NUMBER_1" is found at
496.645, 685.388, 605.778, 513.975  and subsequently is not shown at
all!

Note that I can easily populate all the fields with PdfStamper
(however this approach is not possible because the resulting PDF
becomes far too large), so I suspect there is either something wrong
with my field positions or something related to the setSimpleColumn()
approach. Please assist...

Kind regards,
Torbjorn  (using latest iText)

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to