Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Highlighting help

More
IP: 192.168.0.71 8 years 4 months ago #13063 by jroldare
Highlighting help was created by jroldare
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!
More
IP: 192.168.0.71 8 years 4 months ago - 8 years 4 months ago #13064 by Davide
Replied by Davide on topic Highlighting help
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.
Last edit: 8 years 4 months ago by Davide. Reason: new way
Time to create page: 0.377 seconds
Powered by Kunena Forum