openAt method

void openAt(
  1. PdfPage page, {
  2. PdfOpenActionView view = PdfOpenActionView.fit,
  3. double? left,
  4. double? top,
  5. double? zoom,
})

Makes the document open at page, with the chosen view.

Implementation

void openAt(
  PdfPage page, {
  PdfOpenActionView view = PdfOpenActionView.fit,
  double? left,
  double? top,
  double? zoom,
}) {
  final destination = PdfArray(<PdfDataType>[
    page.ref(),
    PdfName(view.name),
    if (view == PdfOpenActionView.xyz) ...<PdfDataType>[
      PdfNum(left ?? 0),
      PdfNum(top ?? 0),
      PdfNum(zoom ?? 0),
    ],
    if (view == PdfOpenActionView.fitWidth) PdfNum(top ?? 0),
  ]);
  _catalog[PdfNameTokens.openAction] = destination;
}