I'm using the JavaScript PDF library to generate xfdf annotation on Nodejs, here is the code. How can I set the id of the annotation so it appear in the XFDF output? also is there API page of the JavaScript PDF library?
<freetext id="my-annotation-id" page="0" opacity="1" rect="456,272,479,282" justification="0" subject="Text Box">
import {
PdfDocument,
PdfPage,
PdfPopupAnnotation,
PdfPopupIcon,
PdfAnnotationBorder,
PdfAnnotationExportSettings,
DataFormat,
} from "@syncfusion/ej2-pdf";
import * as fs from "fs";
// Creates a new PDF document
let document: PdfDocument = new PdfDocument();
// Adds a new page to the PDF
let page: PdfPage = document.addPage();
// Creates a new popup annotation
let popup: PdfPopupAnnotation = new PdfPopupAnnotation(
"Test popup annotation",
{ x: 10, y: 40, width: 30, height: 30 },
{
author: "Syncfusion",
subject: "General",
color: { r: 255, g: 255, b: 0 },
icon: PdfPopupIcon.newParagraph,
open: true,
},
);
popup.border = new PdfAnnotationBorder({ width: 4, hRadius: 20, vRadius: 30 });
// Adds annotation to the page
page.annotations.add(popup);
let settings: PdfAnnotationExportSettings = new PdfAnnotationExportSettings();
settings.dataFormat = DataFormat.xfdf;
// Saves and download the PDF document
// const data = document.save();
// fs.writeFileSync("PopupAnnotation.pdf", data);
const xfdfData = document.exportAnnotations(settings);
fs.writeFileSync("PopupAnnotation.xml", xfdfData);
// Destroy the document
document.destroy();