isEncrypted property

bool get isEncrypted

Whether the document declares encryption (/Encrypt in the trailer).

Reading encrypted documents is not supported: the streams would come out scrambled.

Implementation

bool get isEncrypted {
  _ensureXrefParsed();
  final root = rootDict;
  if (root != null && root.values.containsKey(PdfNameTokens.encrypt)) {
    return true;
  }
  try {
    return PdfParserFields.hasEncryptDictionary(reader.readAll());
  } catch (_) {
    return false;
  }
}