Copy link to clipboard
Copied
Hello,
Is there a way a to retreive the coordinates of the highlighted text in the viewer.
We are listening to AdobeDC.View.Enum.PDFAnalyticsEvents.TEXT_COPY and we wantto get the coordinates of the copied text.
The event parameter does not contain the coordinates details, is there a way like to execute a command and then get the coordinates of the highlighted text?
Thanks,
Copy link to clipboard
Copied
Thanks for using PDF Embed API. If you are selecting the text in the viewer, you will receive an event (PREVIEW_SELECTION_END), which might help your cause.
Please visit https://www.adobe.io/apis/documentcloud/dcsdk/docs.html?view=view. You will get the required information under section Basic events.
Copy link to clipboard
Copied
Thanks
Copy link to clipboard
Copied
We are able to get coordinates now, the next step is to translate these values into the boundbox and or quadpoints for a new highlight annotation. Is this possible? We want to automatically create an annotation object right after some text(s) are highlighted setting the bodyValue as the highlighted content.
Copy link to clipboard
Copied
Are you sure you want to do that? What if the user highlighted more or less than they intended. My suggestion would be to capture the selected text and if a highlight is added but a new selection is made without adding a body value to the previous highlight, set the bodyValue to the previously selected text.
Copy link to clipboard
Copied
Yes, that is what we are trying to accomplish.
Copy link to clipboard
Copied
I'll put together an example and you can see how I did it. I'll need a day or two.