PdfAnnotationCollection constructor

PdfAnnotationCollection(
  1. PdfPage page, {
  2. PdfObjectStore? store,
  3. PdfLoadedObjectMutator? mutator,
  4. PdfAcroFormAccess? acroForm,
})

Creates the collection of the annotations of page.

store, mutator and acroForm exist for whoever edits several pages in the same operation — the form flattener, for instance — and needs all of them to share the same resolution and the same materializer. When omitted, the collection creates its own.

Implementation

factory PdfAnnotationCollection(
  PdfPage page, {
  PdfObjectStore? store,
  PdfLoadedObjectMutator? mutator,
  PdfAcroFormAccess? acroForm,
}) {
  final resolvedStore = store ??
      mutator?.store ??
      acroForm?.mutator.store ??
      PdfObjectStore.forDocument(page.pdfDocument);
  final resolvedMutator =
      mutator ?? acroForm?.mutator ?? PdfLoadedObjectMutator(resolvedStore);
  return PdfAnnotationCollection._(
    page,
    resolvedStore,
    resolvedMutator,
    acroForm ?? PdfAcroFormAccess(page.pdfDocument, resolvedMutator),
  );
}