Show and hide annotations

Annotations can be shown and hidden at any time.

Show or hide existing annotations in Xamarin.Android viewer

This tutorial only applies to Xamarin.Android.

By default, PDFViewCtrl shows all annotations on PDF document. If you want to hide a particular annotation on PDFViewCtrl, or hide all annotations on PDFViewCtrl, you can hide annotations as follows:

Show and hide one annotation

To show a hidden annotation in PDFViewCtrl, call ShowAnnotation:

C#

1void ShowAnnotation(PDFViewCtrl pdfViewCtrl, Annot annot, int annotPageNum) {
2 pdfViewCtrl.ShowAnnotation(annot);
3 pdfViewCtrl.Update(annot, annotPageNum);
4}

To hide an annotation in PDFViewCtrl, call HideAnnotation.

C#

1void HideAnnotation(PDFViewCtrl pdfViewCtrl, Annot annot, int annotPageNum) {
2 pdfViewCtrl.HideAnnotation(annot);
3 pdfViewCtrl.Update(annot, annotPageNum);
4}

After hide and show an annotation in PDFViewCtrl, You must call update to redraw the area covered with the given annotation.

Show and hide all annotations

Alternatively, you can show/hide all annotations in PDFViewCtrl by calling setDrawAnnotations(boolean). This method toggles the visibility of annotations and form fields.

For example, disabling all annotations and form fields from rendering:

C#

1pdfViewCtrl.SetDrawAnnotations(false);
2pdfViewCtrl.Update(true);

After toggling annotation and form fields visibility in PDFViewCtrl, You must call update to redraw the pdf content.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales