Skip to main content
Known Participant
July 6, 2021
Question

Encountering Several bugs with the Embed Api

  • July 6, 2021
  • 3 replies
  • 4159 views

I'm using the Embed Api and getting hung up on a few bugs:

Text Selection Tools

The text selection tools only show up intermittently

  • A lot of the time when text is selected the tools never show up in order to make a highlight I attached a video showing the behavior

Expectations:

I would expect the selection tools show up after selecting text all the time

 

Annotation Manager:

getAnnotations and removeAnnotationsFromPDF fail with message: "Invalid time value"

It seems that there are particular annotations that are corrupting things, but I don't see why the entire operation should fail.

 

Expectations

- I would expect that getAnnotations would only return valid annotations 

- I would expect that removeAnnotationsFromPDF to remove all annotations regardless if some have corrupt data or not

 

3 replies

New Participant
January 27, 2025

Any update ? Add annotation is still failing for a PDF which already has annotations :

 

 

New Participant
June 9, 2022

Is there any update on this. I am trying to annotate a PDF which already has annotations which results in:

{
     code: "FAIL",
      message: "Invalid time value"
}
Adobe Employee
July 12, 2021

Sorry to hear that you're facing these issues. Would be super helpful if you could share the following information.

 

1. Text Selection Tools: Do you see the issue always or intermittently? Is it specific to the PDF file used in the recording? Would it be possible to share the PDF file so we can take a look.

 

2. Annotation Manager: Can you share any such example annotation data which shows this error? Or the PDF file containing such annotation data.

Known Participant
July 12, 2021

Sure thing.  I've attached two documents named accordingly.

 

The text selection happens intermittently on many pdfs, but this one it seems to happen more consistently.

 

The malformed annotations pdf, I tried to remove all annotations with Adobe Acrobat Pro, however there are several annotations that just continue to re-appear.  Either way, one of them has a malformed date that seems to break several of the embed annotation api calls.

 

Thanks for the help.

 

Colter

Known Participant
July 23, 2021

To add some additional details for you.  I have narrowed down that it's my code that is causing problems but I'm uncertain why.  

 

I am trying to use the PREVIEW_SELECTION_END event in conjuction with the previewApis to getSelectedContent in order to get the current selected content after it has been selected (since the PREVIEW_SELECTION_END event only returns quadpoints / bounding boxes that cant be referenced back to content).

 

It would be ideal for the PREVIEW_SELECTION_END to also return back the current selected content.  I think it would make that event more useful since the bounding boxes that are returned currently can't be used to determine the content that they refer to.

 

// ... more initialization code above    

const previewApis = await preview.getAPIs();
const viewEventHandler = (evt: AdobeDC.ViewCallbackResponse) => {
  console.log("SELECTION END", evt);
  // the following line is causing problems
  previewApis.getSelectedContent().then(({ data: selectionData }) => {
     console.log("selection Data", selectionData)
  });
}

adobeSdk.registerCallback("EVENT_LISTENER",
  viewEventHandler, {
    listenOn: [
       "PREVIEW_SELECTION_END"
    ],
    enableFilePreviewEvents: true
});

 


To add some additional information.  On a hunch I added a delay which fixed the problem.  So it seems that there is a bit of a race condition happening some where.  Anyways, adding a setTimeout with 100ms within my event handler fixed the problem.