documentInformation property

PdfDocumentInformation documentInformation

Gets document's information and properties such as document's title, subject, keyword etc.

Implementation

PdfDocumentInformation get documentInformation {
  if (_documentInfo == null) {
    if (_helper.isLoadedDocument) {
      final PdfDictionary trailer = _helper.crossTable.trailer!;
      if (PdfCrossTable.dereference(trailer[PdfDictionaryProperties.info])
          is PdfDictionary) {
        final PdfDictionary? entry =
            PdfCrossTable.dereference(trailer[PdfDictionaryProperties.info])
                as PdfDictionary?;
        _documentInfo = PdfDocumentInformationHelper.load(_helper.catalog,
            dictionary: entry,
            isLoaded: true,
            conformance: _helper.conformanceLevel);
      } else {
        _documentInfo = PdfDocumentInformationHelper.load(_helper.catalog,
            conformance: _helper.conformanceLevel);
        _helper.crossTable.trailer![PdfDictionaryProperties.info] =
            PdfReferenceHolder(_documentInfo);
      }
      // Read document's info dictionary if present.
      _readDocumentInfo();
    } else {
      _documentInfo = PdfDocumentInformationHelper.load(_helper.catalog,
          conformance: _helper.conformanceLevel);
      _helper.crossTable.trailer![PdfDictionaryProperties.info] =
          PdfReferenceHolder(_documentInfo);
    }
  }
  return _documentInfo!;
}