Hello, I am having trouble in removing a highlight annotation from pdf on Xamarin Android. I'm successfully able to add highlights but can't seem to figure out why removing them using RemoveFromPage() won't work.
Here are some details
Triple checked package name and everything related to licensing (we are using professional version).
Successfully implemented Xamarin.iOS adding and removing highlights. We are not mistakenly using the same package name from the iOS app
We are asking to render the page again after removing annotation.
We are using the latest version (at the writing of this post).
Here is some code:
NativePage is Page.Annotation class from Com.radaee.pdf
public Task<ICorePdfAnnotation> AddHighlight(ICorePdfSel selection, string color)
if (!InitObjs()) return Task.FromResult((ICorePdfAnnotation)null);
var status = NativePage?.AddAnnotMarkup(selection.StartIndex, selection.EndIndex, 0) == true;
ICorePdfAnnotation result = null;
var annotation = NativePage?.GetAnnot(NativePage.AnnotCount - 1);
var colorObj = Color.ParseColor(color);
result = new AndroidPdfAnnotationWrapper(annotation);
Then the wrapper class:
public class AndroidPdfAnnotationWrapper : ICorePdfAnnotation
private Page.Annotation annotation;
public AndroidPdfAnnotationWrapper(Page.Annotation annotation)
this.annotation = annotation;
public bool Remove()
var status = annotation.RemoveFromPage();
the "status" return is always false
Any other additional debugging tips you guys could share?
Hi. What version of the license do I need to work with annotations? Now I have a standard license. I can add annotations with text selection (m_view.vSelMarkup(color, itype)). But I cannot remove them (m_view.vAnnotRemove (). I have the same problem.
if (m_status != PDFV_STATUS.STA_ANNOT) return;
bool r = m_annot.RemoveFromPage();
r - always false
I do not need to save modified pdf.
I try demo licence:
OnPDFAnnotClicked(PDFPage page, PDFAnnot annot) is not called.
to interact and edit annotations you need an active Professional or Premium license.
You may check the trial key but you shall change your current application package name from your own to the same we use in the demo project.