Unable to see/add annotations

Which product are you using?
PDF.js Express Plus – paid for license

PDF.js Express Version
|UI version|‘8.4.1’|
|Core version|‘8.4.0’|

Detailed description of issue
Hi there! I am looking for some assistance in being able to get my annotations working. I have not been able to find examples/documentation with a full working version.
Key functionalities I need:

  1. Load document in the document viewer (working)
  2. load/see existing annotations (XDF)
  3. create/add annotations
  4. save annotations
  5. send annotations XDF to third party API
  6. repeat

Currently I am able to get the ribbon toolbar working via the ui.instance.enableElements([“”]) method, but nothing happens when I click any of the icons (free text tool, highlight, etc). I get an error

Expected behaviour
Would love to be able to utilize the annotation tools

Does your issue happen with every document, or just one?
All documents/haven’t been able to get it to work yet

Link to document
{Provide a link to the document in question if possible}

Code snippet

 WebViewer(
        {
          path: `${process.env.PUBLIC_URL}/pdfjsexpress`,
          initialDoc: "",
          disableFlattenedAnnotations: true,
        },
        viewer.current,
      )
        .then((instance) => {
          const utils = new ExpressUtils();

          const { docViewer, Core, annotManager } = instance;

          instance.UI.loadDocument(
             "https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf",
,
            { filename: "myfile.pdf" },
          );

          instance.UI.setTheme("dark");

          instance.UI.enableElements([
            "ribbons",
            "toolsHeader",
            "leftPanel",
            "leftPanelButton",
          ]);

          docViewer.addEventListener("documentLoaded", async () => {
            console.log("document loaded");
          });
        })

I have tried this snippet found in docs already (only to test something that would show up – didn’t work):

     // const annotManager = docViewer.getAnnotationManager();
          // const rectangle = new Annotations.RectangleAnnotation();
          // rectangle.PageNumber = 2;
          // rectangle.X = 100;
          // rectangle.Y = 100;
          // rectangle.Width = 250;
          // rectangle.Height = 250;
          // rectangle.Author = annotManager.getCurrentUser();
          // annotManager.addAnnotation(rectangle);

          // docViewer.displayLastPage();

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:

Guides:APIs:Forums:

Hello karin,

Is this happening with v8.7 of PDFJS Express? we have recently released this version which includes numerous bug fixes.

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron

Yes I am currently using v8.7

Would you be able to provide a working example with full annotation capabilities as a reference (especially the functionalities I listed :slight_smile: )

Hello karin,

In the original post you mentioned you’re using v8.4.1, it is v8.7.0 now? Are you seeing the error on v8.7?

Would you be able to provide a working example with full annotation capabilities as a reference (especially the functionalities I listed)
Can you clarify what you mean by this? We have our documentation guides on our annotation capabilities here: PDF.js Express Annotations | Documentation

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron