• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Add annotation upon PREVIEW_SELECTION_END

New Here ,
Jun 04, 2024 Jun 04, 2024

Copy link to clipboard

Copied

I'm having trouble programmatically adding a highlight annotation automatically after the user selects a piece of text in the pdf.

I believe my program should listen for PREVIEW_SELECTION_END event, takes the event data, which has bounding box information, before using it as the quad points of the new highlight annotation. I realized the bbox information cannot be directly used and must be converted (subtracting deviceTop/Bottom fields of selection bbox from screen height to get bounding boxes for annotation? not really working...) , and I couldn't find information on the bbox fields of PREVIEW_SELECTION_END event.  

How are the two representations of bounding boxes (text selection v.s. annotation) different? 

What's the proper way to convert them?  
 

 

 

TOPICS
How to , PDF Embed API

Views

56

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources