loadAnnotations: false breaks rendering of explicitly imported annotations (stamps invisible on canvas)

WebViewer Version: 11.12

Do you have an issue with a specific file(s)? yes
Can you reproduce using one of our samples or online demos? no
Are you using the WebViewer server? yes
Does the issue only happen on certain browsers? no
Is your issue related to a front-end framework? yes
Is your issue related to annotations? yes

Please give a brief summary of your issue:

When loadAnnotations: false is passed to instance.UI.loadDocument, stamp annotations imported via annotationManager.importAnnotations(xfdfString) are not rendered on the PDF canvas. They appear in the comments panel but are invisible on the page.

Steps to reproduce:

  1. Configure WebViewer with webviewerServerURL
    Configuration: fullAPI: true, forceClientSideInit: true, webviewerServerURL configured

  2. Load a document with loadAnnotations: false:

    instance.UI.loadDocument(fileUrl, {
        filename: fileName,
        loadAnnotations: false,
        customHeaders: { Authorization: `Bearer ${token}` },
    });
    
  3. On documentLoaded, import XFDF containing a stamp annotation:

    documentViewer.addEventListener("documentLoaded", async () => {
        const xfdfString = await fetchXfdf();
        await annotationManager.importAnnotations(xfdfString);
    });
    
    
  4. Stamp annotation appears in comments panel but is invisible on the canvas

NOTE: The stamp is visible when loadannotations is set to true. And then I do the following

  1. Delete all annotations

    const existingAnnotations = annotationManager.getAnnotationsList();
                if (existingAnnotations.length > 0) {
                    annotationManager.deleteAnnotations(existingAnnotations, {
                        imported: true,
                        force: true,
                    });
                }
    
  2. Import annotations
    await annotationManager.importAnnotations(xfdfString, {imported: true})

    I would like to know what the issue could be when I enable or disable loadannotations

1 Like

Hello Priya,

Thank you for contacting WebViewer Forums.

The loadAnnotations option lets you load a document with or without the initial annotations as documented here: Apryse WebViewer Namespace: UI . Annotations created afterwards are still shown. Are you looking for a specific workflow?

Regards,
Luke

1 Like