Why can't I merge my image stamps into a PDF using a non-PDFNet tool?

29 views
Skip to first unread message

Aaron

unread,
May 19, 2017, 6:59:19 PM5/19/17
to PDFTron PDFNet SDK
Q:

I have image stamps made in PDFTron's WebViewer, and saved to my server as XFDF.  I want to send those to my customer as part of an information recovery process.  For legal reasons, I don't have access to the original PDF, only the XFDF.  My customer doesn't have access to PDFTron, only Acrobat.  It seems that PDFTron's image storage within XFDF is different from how Acrobat does things.  What should I do?

A:

Storing images is functionality not covered by the XFDF specification, so both we (PDFTron) and Acrobat have extended the format to enable doing so.  Acrobat chose to embed PDF content streams, while we chose instead to include base64ed content (since we support using XFDFs outside the context of PDFs, within Universal WebViewer's XOD annotation layer).  Both of these approaches are outside the XFDF standard.  

The best approach, given your lack of access to the original document and your customers' need to use Acrobat, would be to convert the XFDF to FDF.  FDF can store image data in a way that's easier for third-party tools to handle, since FDF are quite similar to PDFs.  

The following lines of PDFNet code will do the trick:

  FDFDoc fdf_doc1 = new FDFDoc(FDFDoc.CreateFromXFDF("customer_annots.xfdf"));
  fdf_doc1
.Save("customer_annots.fdf");

Please note that, to be able to merge this FDF with a PDF within Acrobat, you may first need to delete any existing annotations.  That's because there may already be an annotation in the PDF document with the same NM/name entry as the annotation you're trying to import.

While PDFNet will still merge in such an annotation, Acrobat will reject the new annotation (because of the existing annotation with the same NM/name entry).  So to merge the new annotation in, you would either need to delete existing annotations or change the NM/name entry to another identifier.
Reply all
Reply to author
Forward
0 new messages