Web SDKv1.0.0

AnnotationsApi.exportXFDF()

The annotations and the form field values as XFDF — the interchange format Acrobat, Nutrient and Apryse read. Every text mark, note, shape, drawing, polygon, free text and stamp with its name, author, subject, dates, color, opacity, flags, contents, pop-up and geometry; replies (inreplyto) and review statuses (state); the fields' values (<fields>, nested by the dots in their names) as doc.forms.getValues() reads them. A stamp goes out by its name and box alone — its picture stays in the document; a member of an annotation group goes out as an annotation of its own. Dates go out as PDF date strings, coordinates are the page's own, colors #RRGGBB.

Names are the hinge: the SDK writes every annotation's own name as its name, matches by it on import, and reads Acrobat's own names back, so a round trip through a review backend neither duplicates nor loses a comment. Needs the extract feature (the file carries the document's words) and, for the annotations, annotations.

methodXFDFsince 1.0.0

Signature

exportXFDF(options?: XFDFExportOptions): Promise<string>

Parameters

ParameterTypeDescription
options?XFDFExportOptionsannotations (default true), fields (default true), links (default false: a link has no name in most files and would be duplicated by a re-import), pages (zero-based; omitted, every page), href (the <f href> file name Acrobat shows).

Returns

Promise<string> A UTF-8 XML string.

Throws

  • INVALID_ARGUMENT — pages is not an array of pages of the document.
  • FEATURE_NOT_LICENSED — the license lacks extract, or annotations for the annotations.
  • DOCUMENT_CLOSED — the document has been closed.

Example

TypeScript
const xfdf = await doc.annotations.exportXFDF({ href: 'contract.pdf' });
await fetch('/reviews/' + id, { method: 'PUT', body: xfdf });

More in AnnotationsApi