Existing Annotation(annotation is created using Adobe ) is getting clear after merging PDF and xfdf (New Annotation) File


Product Version:

Please give a brief summary of your issue:

Sample code used to merge the PDF and xfdf file

            FDFDoc fdf_doc1 = new FDFDoc(FDFDoc.CreateFromXFDF(input_path + "form1_data.xfdf"));
            fdf_doc1.Save(output_path + "form1_data.fdf");

            // annotations
            Console.WriteLine("Import annotations from XFDF to FDF.");

            FDFDoc fdf_doc2 = new FDFDoc(FDFDoc.CreateFromXFDF(input_path + "form1_annots.xfdf"));
            fdf_doc2.Save(output_path + "form1_annots.fdf");

            // FDF to PDF
            // form fields
            Console.WriteLine("Merge form field data from FDF.");

            PDFDoc doc = new PDFDoc(input_path + "webviewer-demo-annotated.pdf");

            // To use PDFNet form field appearance generation instead of relying on
            // Acrobat, uncomment the following two lines:
            // doc.RefreshFieldAppearances();
            // doc.GetAcroForm().Put("NeedAppearances", Obj.CreateBool(false));

            doc.Save(output_path + "form1_filled.pdf", SDFDoc.SaveOptions.e_linearized);

            // annotations
            Console.WriteLine("Merge annotations from FDF.");

            doc.Save(output_path + "form1_filled_with_annots.pdf", SDFDoc.SaveOptions.e_linearized);


(Think of this as an email subject)

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

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

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:



Thank you for contacting WebViewer’s support. It looks like the code you posted is from one of our sample (seems like it’s from the “FDFTest” sample). I tried adding annotation in Adobe to the input file and running the code you posted above and it seems to work fine. One thing to note is the code wouldn’t be able to override the existing output file if it opened in another program.

Would it be possible to get more information about how you’re using the code? Which version of our SDK are you using (language and version)? Also what is the inputs are you using (what does your PDF and fdf files look like)? Thank you

Best Regards,

Andrew Yip
Software Developer
PDFTron Systems, Inc.