destination property

PdfDestination? get destination

Gets or sets the destination of the annotation.

//Create a new Pdf document
PdfDocument document = PdfDocument();
//Create PDF page.
PdfPage page = document.pages.add();
//Create a document link
PdfDocumentLinkAnnotation documentLinkAnnotation = PdfDocumentLinkAnnotation(
    Rect.fromLTWH(10, 40, 30, 30),
    PdfDestination(document.pages.add(), Offset(10, 0)));
//Gets the destination and set the destination mode.
documentLinkAnnotation.destination!.mode = PdfDestinationMode.fitToPage;
//Add the document link to the page
page.annotations.add(documentLinkAnnotation);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfDestination? get destination =>
    PdfAnnotationHelper.getHelper(this).isLoadedAnnotation
        ? _obtainDestination()
        : _helper.destination;
set destination (PdfDestination? value)

Implementation

set destination(PdfDestination? value) {
  if (value != null) {
    if (value != _helper.destination) {
      _helper.destination = value;
    }
    if (PdfAnnotationHelper.getHelper(this).isLoadedAnnotation) {
      PdfAnnotationHelper.getHelper(this)
          .dictionary!
          .setProperty(PdfDictionaryProperties.dest, value);
    }
  }
}