We use iText to convert Java-based reports to the PDF format. The report
has some fields activated (mouseclisk-sensitive); on the iText side we
use PdfAcroForm object to sensitize the field area. The PdfAcroForm
coordinates are calculated from the bottom of the page, so that for
792-pixel high page if the field'd ordinate in Java is e.g. 100 (from
the top of the page), then in iText the ordinate is (792 - 100) = 692.
It works if the report has only 1 page.

The problems begin with a multi-page report. The fields on the last
(bottom) page come out as expected. But none of the fields on pages
above the bottom one are sensitized. I think this is a matter of setting
correct coordinates to the PdfAcroForm, but so far I have not been able
to figure it out.

Here is an example for a 2-page report. For page 2 (the bottom page) the
field ordinate is: y=500 (the report bottom being the origin). The
PdfAcroForm is added correctly, the field is mouse-sensitive. For page 1
(the top page) the field orinate is: y = 1292 (added one page height =
792 pixels). PdfAcroForm is not there (at least, not where I expect it).

I tried setting the PdfAcroForm coordinates relative to the bottom of
the page the field belongs to, rather than the bottom of the entire
report, but it did not work either.

In case this matters: to produce the PDF report from Java, we use
PdfContentByte, and add a new PdfTemplate object to it for each page of
the report:

                PdfTemplate tp = cb.createTemplate(width, height);
                Graphics2D g2 = tp.createGraphics(width, height,
mapper);
                g2.translate(0, -height * page);
                imageProvider.paintContents(g2);
                g2.dispose();
                cb.addTemplate(tp, 0, 0);

Any ideas?

This is quite urgent; any help/hints are greatly appreciated.

TIA.

Alex Molochnikov
Gestalt Corporation


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg297
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to