How to disable and enable a particular annotation using android sdk

Hello,

Our requirement is to drag the annotation with over-layer it should move the inserted annotation together and place it where i need.

The below steps which i followed to implement the above feature in AnnotEdit.java:

  • upon selecting annotation, removing annotation from page using this method “page.annotRemove(mAnnot)”.

Page page = mPDFView.getDoc().getPage(mAnnotPageNum);
page.annotRemove(mAnnot);
mPDFView.update(mAnnot, mAnnotPageNum); // This step makes the pdf page blurriness.

  • Redraw the shape on client side using “canvas.drawBitmap

  • moved the client shape around while dragging

  • onUp listener inserting annotation back to the page using this method “page.annotInsert(0,mAnnot)

Page page = mPDFView.getDoc().getPage(mAnnotPageNum);
page.annotInsert(0, mAnnot);
mPDFView.update(mAnnot, mAnnotPageNum);

Please let me know if above step are correct? or Is there any better way to implement the above feature?

When I remove the annotation from page and update, around the annotation there will be blurriness in the page this happens only when i remove annotation from page, no issues while inserting annotation. How to fix this? or Is there better way to disable/enable a selected annotation from page?

Thanks,
Sivakumar s.

You may want to try mPDFView.waitForRendering():

https://www.pdftron.com/pdfnet/mobile/docs/Android/pdftron/PDF/PDFViewCtrl.html#waitForRendering(int)

Hi Aaron,

Is there no option to disable/enable annotation instead of removing and inserting annotation?

PDFNet does not provide a way to enable or disable individual annotation rendering. You can, however, disable rendering of all annotations with PDFViewCtrl.setDrawAnnotations:

https://www.pdftron.com/pdfnet/mobile/docs/Android/pdftron/PDF/PDFViewCtrl.html#setDrawAnnotations(boolean)