Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Highlighting help 6 years 5 months ago #13063

  • jroldare
  • jroldare's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
Good evening,

We are currently working on an Android app that includes a PDF viewer. Our app needs to have the option for highlighting text and deleting some/all these highlights afterwards. Currently we are using PDFLayoutVIew.PDFSetSelect() for selecting the text, but we are not able to figure out the way of deselecting the text in the same manner (by touching and dragging). What we are doing right now is trying to do another PDFSetSelect() with a different colour to cover the old one, but that doesn't seems to work.

Does anyone know if there is any way to achieve this behaviour?
Thank you very much!

Please Log in or Create an account to join the conversation.

Highlighting help 6 years 5 months ago #13064

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
this is not supported by PDF format.
You can add an highlight and remove it completely using annot.RemoveFromPage()
Using another PDFSetSelect() with a different colour will created another annotation on top of the existing one. I suggest you not to add another highlight but using the coordinate rect of the second PDFSetSelect() try to modify the rect of the first highlight annot.
After your calculation you can modify the first highlight using annot.SetRect(float, float, float, float)

You can also save the start and end char index, when you do the second highlight between these index, you compare "in not" the new indexes with the old ones and you split the highlights, something like that :

id_start_1; id_end_1 + id_start_2; id_end_2
id_start_1 < id_start_2 < id_end_2 < id_end_1

The new highlights will be :
id_start_1; id_start_2
id_end_2; id_end_1

If you add another highlight you will use the same logic.

Please Log in or Create an account to join the conversation.

Last edit: by Davide. Reason: new way
  • Page:
  • 1
Powered by Kunena Forum