title property

String get title

Gets or sets the outline title.

//Create a new document.
PdfDocument document = PdfDocument();
//Create document bookmarks.
document.bookmarks.add('Page 1')
  ..destination = PdfDestination(document.pages.add(), Offset(20, 20))
  ..textStyle = [PdfTextStyle.bold]
  ..color = PdfColor(255, 0, 0)
  //Set the bookmark title.
  ..title = 'Bookmark';
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

String get title {
  if (_isLoadedBookmark) {
    return _obtainTitle();
  } else {
    final PdfString? title =
        _helper.dictionary![PdfDictionaryProperties.title] as PdfString?;
    if (title != null && title.value != null) {
      return title.value!;
    } else {
      return '';
    }
  }
}
set title (String value)

Implementation

set title(String value) {
  _helper.dictionary![PdfDictionaryProperties.title] = PdfString(value);
}