Unable to access setCustomData in WebViewer

WebViewer Version: 8.0.1

Hi I am unable to use setCustomData() in WebViewer.

Here’s my code snippet

).then(instance => {
            const { Core } = instance;
            const { annotationManager, PDFNet } = Core;
            annotationManager.one("annotationChanged", () => {
                PDFNet.Annot.setCustomData("Key", props.value);        

Is this the right way to call the method as it throws error “Property ‘setCustomData’ does not exist on type ‘typeof Annot’”

My use case is I want to add a custom attribute to each annotation added to the document which can be exported as xfdf. Can you please provide the correct implementation for my use case?


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:


You probably using the wrong API, you need to use annotation.setCustomData API like as following:

    const { annotationManager } = instance.Core;
    annotationManager.addEventListener('annotationChanged', (annotations, action) => {
      if (action === 'add') {
        console.log('this is a change that added annotations');
        annotations.forEach((annotation) => {
             annotation.setCustomData('key', 'data')