Skip to main content
Participant
Mar 12, 2021 6:08 PM UTC
Answered

Events not dispatched for top-level annotations due to error

In the Adobe DC PDF View SDK, I'm experiencing an issue similar to this one in that top-level annotations of any kind will not be persisted. Commenting on particular parts of text will respond with that error, but no annotations besides replies will dispatch an ANNOTATION_ADDED event. ANNOTATION_COUNT does increase for text comments despite the error that displays.

 

I've isolated the failure - registering callbacks besides the following do not affect the presence of the error:

 

          previewFilePromise.then((adobeViewer) => {
            adobeViewer.getAnnotationManager().then((annotationManager) => {
              annotationManager.registerEventListener(function (event) {
                console.log(event.type, event.data)
              }, eventOptions)
            })
          })

 

 Here's the traceback, though it's cryptic due to the lack of sourcemaps:

 

Uncaught TypeError: t is undefined
    _validateMinLength https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validatePropertySource https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validateProperty https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validateObjectForKeyList https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validateObjectForKeyList https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validateObject https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validatePropertyTarget https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2
    _validateProperty https://documentcloud.adobe.com/view-sdk/2.15.0_2.1.0-45e9ffb/AdobeDCViewApp.js:2

 

I've attached the PDF I'm using for the benefit of testing.

This topic is closed to new replies. Start a new post to keep the conversation going.
Sumona GhoshCorrect answer
Adobe Employee
Mar 12, 2021 6:41 PM UTC

HI, sorry for the inconvenience. Could you check if you are passing file ID in the metadata while invoking the previewFile API? When you enable the annotation APIs, you must pass a PDF ID in the metadata field to uniquely identify the PDF so that annotations can be added.

Let us know if this solves the issue. Thanks!

 

2 replies

Sumona GhoshCorrect answer
Adobe Employee
Mar 12, 2021 6:41 PM UTC

HI, sorry for the inconvenience. Could you check if you are passing file ID in the metadata while invoking the previewFile API? When you enable the annotation APIs, you must pass a PDF ID in the metadata field to uniquely identify the PDF so that annotations can be added.

Let us know if this solves the issue. Thanks!

 

Translate
Raise5C07Author
Participant
Mar 15, 2021 10:17 AM UTC

Adding the `id` field to the `metaData` object fixed my issue. Thanks for your prompt response!

Translate