remove method

bool remove(
  1. PdfAnnotationView view
)

Removes view from the page.

Takes the entry out of /Annots and, when the annotation is a form widget, out of /AcroForm /Fields too. Returns true when something was removed.

Implementation

bool remove(PdfAnnotationView view) {
  final annots = _writableAnnots();
  if (annots == null) return false;

  final removed = _removeEntry(annots, view);
  if (!removed) {
    _warnings.add('Anotação ${view.reference ?? 'direta'} não está em '
        '/Annots da página ${page.objser}.');
    return false;
  }

  final reference = view.reference;
  if (view.isWidget && reference != null) {
    acroForm.removeField(reference);
  }

  _views?.remove(view);
  return true;
}