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!
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 :