How do I merge annotations from multiple PDF documents into a single document?

Q: I would like to merge the annotations from multiple PDF documents
into a single document. Here is the scenario: Three identical copies
of a PDF are distributed to 3 individual reviewers. Each reviewer will
open the PDF copy using Adobe Professional, then proceed to add
annotations to the PDF -- sticky notes, highlighting, etc. Once the
process is completed, the reviewers will save the document to a pre-
determined location. Thereafter, the documents will be consumed by a
program that combines all of the annotations onto a single copy of the
document. Since each reviewer is reviewing the same document, we do
not need three copies of the document; we only want one copy, with the
annotations from all three reviewers. Can PDFNet SDK be used to
implement this?
A: You can use PDFNet SDK ( to programmatically
merge annotations (either on the client or on the server). As a
starting point you may want to take a look at 'AnnotationTest' sample
project: You
can either recreate the annotations from scratch (based on the
annotations from source PDFs) or import the annotation dictionaries
(you would need to alter some entries in annotation dictionaries to
make it work - this is similar to the code below)

Another approach to annotation merging is using FDF (Forms Data
Format) merge file. Using Acrobat Pro you can export annotations from
'Menu' > 'Commnets' > 'Export Comments' > 'To File'. This is
illustrated in the following code sample:

... Initialize PDFNet ...
PDFDoc doc = new PDFDoc("test.pdf");
FDFDoc fdf_doc = new FDFDoc("merge.fdf");
Obj root = fdf_doc.GetRoot();
Obj src_annots = root.Get("FDF").Value().Get("Annots").Value();
// Import the annotaions to destination document.
Obj annots = doc.GetSDFDoc().ImportObj(src_annots, true);
// Now place the annotations on PDF pages.
// In this case we will place all annotations on the first page
int num_annots = annots.Size();
for (int i=0; i<num_annots; ++i) {
    // Use 'Page' entry in the annotation dictionary to find the
    // destination page number. For example,
    Obj annot_dict = annots.GetAt(i);
    Obj dst_pg = annot_dict.FindObj("Page");
    if (dst_pg != null) {
      // Note: in FDF, pages are numbered starting from 0; PDFNet
numbers pages starting from 1.
      int page_num = (int) dst_pg.GetNumber() + 1;
      Page page = doc.GetPage(page_num);
      if (page != null) {
         page.AnnotPushBack(new Annot(annots.GetAt(i)));
doc.Save("output.pdf", Doc.SaveOptions.e_linearized);

Q: I extracted the FDF using this:

            PDFDoc doc2 = new PDFDoc("c:\\CommentedDocs\\copy2.pdf");

            FDFDoc fdf_out = doc.FDFExtract();

            FDFDoc fdf_doc = new FDFDoc("c:\\CommentedDocs\

            Obj root = fdf_doc.GetRoot();
            Obj src_annots =

            // Import the annotaions to destination document.
            Obj annots = doc.GetSDFDoc().ImportObj(src_annots, true);

I tried writing the FDF to file and just to a stream, but both with
the same errors.

Do I have to use Adobe to save the FDF and make it work, rather than
extracting the FDF as above?
A: You would need to extract the FDF using Acrobat ('Menu' >
'Commnets' > 'Export Comments' > 'To File'.).
PDFNet method doc.FDFExtract() is used to extract forms data in FDF
format and not annotations.

Using PDFNet you can also implement direct annotation merging (i.e.
without exporting FDF from Acrobat), but in this case you would not
use FDF at all. Instead you would walk through annotations on each
page in the input PDF and would recreate annotations in the target PDF