XFDF does not show Stamp annotation when generated from Python

Product:
PDFNetPython3
Product Version:

Please give a brief summary of your issue:
When I add Stamp annotation via Python apis and try to generate XFDF out of the document, generated XFDF does not show the annotation.

Please describe your issue and provide steps to reproduce it:

This is how I am adding Stamp annotation:

s = Stamper(Stamper.e_relative_scale, 0.1, 0.1)
    s.SetOpacity(1)
    s.SetAsBackground(False)
    s.SetAlignment(Stamper.e_horizontal_left, Stamper.e_vertical_top)
    s.SetTextAlignment(Stamper.e_align_center)
    s.SetPosition(100, 100)
    img = Image.Create(doc.GetSDFDoc(), 'stamp.png')
    ps = PageSet(1)
    s.StampImage(doc, img, ps)
    doc.Save('output/stamp.pdf', SDFDoc.e_linearized)

And XFDF is generated like this:

doc = PDFDoc('output/stamp.pdf')
doc.InitSecurityHandler()
doc_fields = doc.FDFExtract(PDFDoc.e_both)
doc_fields.SaveAsXFDF('output/xfdf/stamp.xfdf')

Please provide a link to a minimal sample where the issue is reproducible:

Found this out. I had to set the stamp as Annotation and now it is showing up in xfdf.

1 Like