PdfInterpreter class

Executes page content streams against a PdfDevice.

Coverage: paths, transforms, device color spaces, clipping, text positioning/showing (with metric-accurate advances), form XObjects, image XObjects and inline images (decoding delegated to the device), shadings, patterns, soft masks, Type3 fonts, and annotation appearance streams.

Constructors

PdfInterpreter({required CosDocument cos, required PdfDevice device, bool scanImagesOnly = false, bool resolveOverprint = true, bool collectCharOffsets = false, PdfCancellationToken? cancellation})

Properties

cancellation PdfCancellationToken?
final
collectCharOffsets bool
Whether to fill in PdfTextRun.charOffsets - the em-space pen position of every character boundary in a run (issue #647) - for every run.
final
cos → CosDocument
final
device PdfDevice
The render target. Mutable only for the record-once/replay-per-tile path (#524), which briefly redirects the walk into a RecordingPdfDevice while a tiling-pattern cell is captured; it is always restored before control returns to the caller.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
resolveOverprint bool
Whether to resolve overprint (§8.6.7) against a colorant buffer rather than leaving the painting device to approximate it (issue #502).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

beginPageContent(PdfPage page, Uint8List content, {int? operationLimit}) PdfPageContentWalk
Begins a resumable walk of this page's content.
drawAnnotation(PdfPage page, PdfAnnotation annotation) → void
Draws a single annotation's appearance stream - the one-annotation slice of drawAnnotations, for callers that need an annotation rendered in isolation (e.g. a live drag preview).
drawAnnotations(PdfPage page, {bool skip(PdfAnnotation)?, bool forPrint = false}) → void
Draws the page's annotation appearance streams, normally called after drawPage so they paint over the content (§12.5.5).
drawPage(PdfPage page) → void
drawPageContent(PdfPage page, Uint8List content, {int? operationLimit}) → void
Parses and interprets content incrementally without retaining a page-sized ContentOperation list.
drawPageContentAsync(PdfPage page, Uint8List content, {int? operationLimit, int yieldInterval = _yieldInterval}) Future<void>
Async, cancellable counterpart to drawPageContent.
drawPageOperations(PdfPage page, List<ContentOperation> operations) → void
Runs an already-parsed page content stream. Parsing (and the underlying stream decompression) dominates rendering on graphics-rich pages, so a renderer that interprets a page more than once - e.g. the image-collect pass and the paint pass in PdfPageRenderer.renderPicture - parses the content once and feeds the same operations to both passes.
drawPageOperationsAsync(PdfPage page, List<ContentOperation> operations, {int yieldInterval = _yieldInterval}) Future<void>
Like drawPageOperations but yields to the event loop every _yieldInterval operators so a PdfCancellationToken set from outside (via an isolate message or Web Worker postMessage handler) can fire.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(List<ContentOperation> operations, CosDictionary resources) → void
Runs a parsed content stream against resources (used by tests).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

debugFontCacheLength int
Number of fonts currently held in the shared cache (test hook).
no setter
debugResolveOverprint bool
Process-wide kill switch for the colorant-buffer overprint path (issue #502). Off, overprint state is still parsed and delivered but no buffer is built and no draw is resolved, so painting devices fall back to their own approximation - the A/B baseline the guard test measures against.
getter/setter pair

Static Methods

clearFontCache() → void
Empties the shared font cache. Tests that assert on load behaviour or measure cold timings call this first; ordinary rendering never needs to.

Constants

defaultWalkChunkOperations → const int
Default operations per PdfPageContentWalk.advance chunk when the caller does not choose one. Large enough that the per-chunk overhead is noise on a dense sheet, small enough that a chunk is a fraction of a heavy page.