3
votes

I am using FOP to generate the PDF from XSL:FO and iText to apply the digital signature and signed date field in the PDF.

Problem is i am using co ordinates to apply the signature and date in the generated PDF.

The PDF are large, dynamic and changing always based on content. therefore the signature and date fields were not positioned Properly by the co-ordinates specified.

I googled to find solution for a long days. But i didnt get any solutions.

Can u please any one suggest me to create the PDF form fields in the PDF using FOP? Then i can apply signature and date fields by using iText.

Please tell me any other technology to try to solve this problem?

1

1 Answers

0
votes

The problem is that FOP doesn't create signature fields whereas iText needs a page number and coordinates (either defined by you or by a signature field).

Where do you want the signature to be placed? Is it always on the first page? Always on the last page? Can you put some unique text at the location where you want the document to be signed?

I'm asking this because you could put words like SIGN HERE on the last page, and then use TextRenderInfo to retrieve the coordinates of those words. See http://itextpdf.com/examples/iia.php?id=275 in combination with http://itextpdf.com/examples/iia.php?id=282

The TextRenderInfo class has methods such as getBaseLine(), getDescentLine(),... who give you LineSegment object which reveal the coordinates of each snippet of text in your PDF.

There are plenty of caveats: FOP could cut the words SIGN HERE in different snippets, such as "SIG", "N", "HE", "RE" which would make it difficult to recognize the unique string, but it's worth investigating.