PdfDocumentParser class
Concrete parser for reading an existing PDF.
Focus: robustness with real-world PDFs, including files with common structural problems (e.g. old iText output).
- Inheritance
-
- Object
- PdfDocumentParserBase
- PdfDocumentParser
Constructors
- PdfDocumentParser(Uint8List bytes, {bool enableCache = true, int cacheBlockSize = 256 * 1024, int cacheMaxBlocks = 32, bool allowRepair = false})
- PdfDocumentParser.fromReader(PdfRandomAccessReader reader, {bool enableCache = true, int cacheBlockSize = 256 * 1024, int cacheMaxBlocks = 32, bool allowRepair = false})
Properties
- bytes → Uint8List
-
The existing PDF document content.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEncrypted → bool
-
Whether the document declares encryption (
/Encryptin the trailer).no setter -
objectIds
→ List<
int> -
Object numbers known to the cross-reference table.
no setter
- pageCount → int
-
Number of pages in the document.
no setter
-
pageRefs
→ List<
PdfRefToken> -
Page references, in document order.
no setter
- reader → PdfRandomAccessReader
-
Random access reader.
finalinherited
- rootDict → PdfDictToken?
-
The document catalog dictionary.
no setter
- rootRef → PdfRefToken?
-
Reference of the catalog (
/Root), when it can be located.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
The objects size of the existing PDF document.
no setteroverride
- trailer → TrailerInfo
-
Trailer information (
/Root,/Info,/ID,/Size).no setter - version → PdfVersion
-
The PDF version of the parsed document.
no setteroverride
- xrefOffset → int
-
The offset of the previous cross reference table.
no setteroverride
Methods
-
asIntArray(
dynamic value) → List< int> ? -
extractImages(
{int? fromPage, int? toPage, bool includeUnusedXObjects = false}) → List< PdfImageInfo> - Extracts images from the PDF with page range support.
-
extractInfo(
{int? maxPages}) → PdfDocumentInfo -
extractSignatureFieldEditContext(
) → PdfSignatureFieldEditContext -
Extracts complete information for editing signature fields.
override
-
extractSignatureFields(
) → List< PdfSignatureFieldInfo> - Extracts information about signature fields (/FT /Sig).
-
getObject(
int objId) → ParsedIndirectObject? - Reads an indirect object by number, with the stream data when present.
-
inheritedPageAttribute(
PdfDictToken pageDict, String key) → dynamic -
Value of an inheritable page attribute (
/Rotate,/CropBox, …), looked up on the page itself and then on its ancestors. -
mergeDocument(
PdfDocument pdfDocument) → void -
Imports the existing objects into the new PDF document.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pageDictAt(
int pageIndex) → PdfDictToken? - Dictionary of a page by index (zero-based).
-
readStreamData(
PdfIndirectRef ref) → Uint8List? - Reads the raw stream bytes of an indirect object. Useful for image extraction (returns the stream with filters undecoded).
-
resolve(
dynamic value, {int maxDepth = 32}) → dynamic -
Resolves
valuedown to a direct value, following indirect references. -
resolvePageMediaBox(
PdfDictToken pageDict) → List< double> ? -
Effective
/MediaBoxof the page, taking inheritance into account. -
resolvePageResources(
PdfDictToken pageDict) → PdfDictToken? -
Effective
/Resourcesof the page, already merged with what it inherits from the ancestor nodes of the/Pagestree. -
storageOf(
int objId) → XrefType? -
How the object is stored: directly in the file, inside an object stream,
or free.
nullwhen the table does not know about it. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited