removeWhenEmpty method

bool removeWhenEmpty()

Takes the /AcroForm out of the catalog when no field is left.

Returns true when the dictionary was removed.

Implementation

bool removeWhenEmpty() {
  final form = writableDictionary();
  if (form == null) return false;

  final fields = writableFields();
  if (fields != null && fields.values.isNotEmpty) return false;

  document.catalog.params.values.remove(PdfNameTokens.acroForm);
  return true;
}