Product: pdftron/webviewer
Product Version:“@pdftron/webviewer”: “^10.4.0”,
Please give a brief summary of your issue:
i create custom button in header on its click its generate custom annotations
it working but on annotationManager.exportAnnotations() its generate error
error is:webviewer-core.min.js:269 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘slice’)
Please describe your issue and provide steps to reproduce it:
header.push({
type: "customElement",
render: () => {
const textBoxButton = document.createElement("button");
textBoxButton.textContent = "Add Annotation";
textBoxButton.addEventListener("click", async () => {
// Create a new FreeTextAnnotation
const annotation = new Annotations.FreeTextAnnotation(
Annotations.FreeTextAnnotation.Intent.FreeText,
{
PageNumber: 1,
X: 100,
Y: 100,
Width: 200,
Height: 50,
TextAlign: "center",
TextVerticalAlign: "middle",
Contents: "Sample Text",
Subject: "CustomAnnotation",
}
);
// Add the annotation to the document
annotationManager.addAnnotation(annotation);
annotationManager.redrawAnnotation(annotation);
// Optionally, you can export the annotations to XFDF format
const xfdfString = await annotationManager.exportAnnotations();
console.log("XFDF String:", xfdfString);
});
return textBoxButton;
},
});
Please provide a link to a minimal sample where the issue is reproducible: