Merge XFDF signature with iText

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.7.4

Detailed description of issue
I have extracted the XFDF from PDF.js Express Plus and attempted to merge the XFDF with the original PDF to create a combined PDF. This works with the PDF.js API but I could not get it to work with iText. iText will merge the form field values, but not the signature which is stored in the XFDF as . Does iText support the format of the signature created by PDF.js?

Expected behaviour
Combine signature with PDF.

PDF.js API:

iText:

Does your issue happen with every document, or just one?
Just one sample document I am testing with.

Hello ekaleida,

Can you provide an example of the PDF and XFDF that you were testing with?

Best regards,
Tyler

Hello Tyler, please find PDF and XFDF attached.

~WRD0000.jpg

RightsRespAdobe.pdf (167 KB)

(Attachment xfdf.xml is missing)

Hello, I was able to attach the PDF but not the XFDF file. The XFDF was rejected.

RightsRespAdobe.pdf (167 KB)

Hello ekaleida,

Try attaching the XFDF as a txt file (or just pasting it directly in the reply)

Best regards,
Tyler

[Image removed by sender.]
tgordonhttps://pdfjs.community/u/tgordon
July 10

Hello ekaleida,

Try attaching the XFDF as a txt file (or just pasting it directly in the reply)

Best regards,
Tyler

~WRD0000.jpg

(Attachment xfdf.txt is missing)

The txt attachment was rejected, so I zipped it.

~WRD0000.jpg

xfdf.zip (1.77 KB)

Hello ekaleida,

I was able to import the annotations with:

instance.Core.annotationManager.importAnnotations(xfdf);

PDFJS Express adheres to the XFDF standard, meaning whichever product you use it should merge the XFDF as expected.

I will talk to the iText support to discuss if PDFJS Express is incorrectly generating the XFDF.

Best regards,
Tyler

Hello ekaleida,

How are you merging the XFDF with iText? Just to confirm the behaviour to reproduce the issue.

Thank you,
Tyler

I am using this example code I found online for iTextSharp:

PdfReader template = new PdfReader(“RightsRespPDFJS.pdf”);

XfdfReader xfdfReader = new XfdfReader(“xfdf.xml”);

PdfStamper stamper = new PdfStamper(template, new FileStream(“RightsRespMerged.pdf”, FileMode.Create));

stamper.AcroFields.SetFields(xfdfReader);

stamper.Writer.CloseStream = false;

stamper.Close();

~WRD0000.jpg

Unfortunately, I have found that iText will not imbed the signature in the document when merging. iText will only embed values found within the tag in the XFDF and the signature is stored in by PDFJS Express.