dart_pdf_editor library
Flutter widgets for viewing and editing PDF documents.
Classes
- CanvasPdfDevice
- Paints interpreter callbacks onto a Flutter Canvas.
- CreateSigningIdentityForm
- The body of the create-identity dialog, exposed on its own so it can be embedded (e.g. in a settings page) and tested without a Dialog host.
- DartPdfEditorLocalizations
-
Callers can lookup localized strings with an instance of DartPdfEditorLocalizations
returned by
DartPdfEditorLocalizations.of(context). - InMemoryIdentityStore
- An in-memory PdfIdentityStore - identities live only for the session. Useful for tests and for a "don't remember me" flow.
- PdfAnnotationMenuItem
- One entry in the annotation context menu. Hosts add their own through PdfViewer.annotationMenuBuilder; the stock entries (z-order, delete) are built the same way internally.
- PdfAnnotationMenuRequest
- What an annotation context menu acts on: the controller and the selection at the moment the menu opened. The right-clicked annotation is always part of the selection (the viewer selects it before the menu shows); a right-click on an already-selected annotation keeps a multi-selection intact, so annotations can hold several entries.
- PdfAnnotationPropertiesPanel
- A panel showing - and editing - the selected annotation's properties.
- PdfAnnotationSidebar
- A panel listing every annotation in the document, grouped by page, each tile showing its author (/T) when the annotation carries one. Form-field tiles show the field's kind, fully qualified name, and current value; link tiles show the text under the link and where it goes (the URI, or the target page).
- PdfAnnotationSnapshotClipboard
- A clipboard for copied annotations, shared across documents: copy or cut annotations in one PdfEditingController, then paste them back into the same document - or into a different open document tab, since every controller shares the process-wide instance by default.
- PdfAnnotationTapDetails
- Information about a PDF annotation tap.
- PdfBookmarkSidebar
- Dockable PDF outline/bookmarks panel.
-
PdfBudgetedCache<
K, V> - One bounded, least-recently-used cache that every in-package cache is built on, so the eviction rules live (and are property-tested) in exactly one place instead of being re-derived - subtly differently, and with a fresh off-by-one each time - at six call sites.
- PdfBundledFont
- A font offered in the font menu without a file picker, its bytes loaded lazily on pick (loadBundledFont).
- PdfBytesByteSource
- A PdfByteSource backed by a complete in-memory buffer. Handy for tests and for adapting already-downloaded bytes to the source-based API.
- PdfByteSource
- A random-access, possibly asynchronous source of PDF bytes.
- PdfCacheRegistry
- The one place a memory-pressure signal fans out to every in-process cache.
- PdfCachingRenderWorker
- Wraps a PdfRenderWorker with an LRU cache of completed record results, keyed by (page, annotations, decodeImages, image-ratio bucket, command-limit, image-decode-region when decoded image bytes are present). The lazy page list recycles a PdfPageView's State when it scrolls out of view and re-creates it on the way back, dropping the State's cached picture - so without this every scroll-back re-asks the worker to decode the page from scratch (a multi-second inflate + colour-convert on a raster-heavy CAD sheet, observed re-running ~7× for one page during a single scroll). A page's bytes don't change under the worker (it holds a fixed snapshot), so a completed buffer stays valid for the worker's whole life - caching it makes a revisit a map lookup instead of a re-decode. The cache lives on the worker, so it is shared across every recycled page widget and dies with the worker (a new document opens a new worker, hence a fresh cache).
- PdfCancelToken
- Cooperative cancellation for a PdfHttpByteSource. Call cancel to stop an in-progress or subsequent load; pending and future reads then throw a PdfHttpCancelledException. A token is single-use.
- PdfCanvasTileRasterBackend
- The universal retained-scene renderer used today and as a fallback for accelerated backends.
- PdfColorPicker
- A compact full-spectrum color picker: a saturation/value area, a hue slider, a value row - hex, RGB, HSL, or CMYK, switchable - kept in sync, and a grid of quick-pick swatches (a fixed palette plus, when supplied, the colours recently chosen and the colours already used in the document). Annotation opacity is a separate controller property, so the picker deals in opaque colors.
- PdfComparisonController
-
Drives a document comparison view: it pairs the two documents' pages,
computes a word-level text diff per matched page (a
PdfTextDiff), and exposes the resulting changes as an ordered, navigable list - the model behind the diff navigator panel. - PdfComparisonView
- Compares two PDF documents visually.
- PdfContextMenuRequest
- A context menu the host is asked to render, with everything the viewer already resolved about the gesture.
- PdfCustomStamp
- A reusable rubber stamp: visual template plus optional app metadata.
- PdfDebugDetailRegions
- Debug registry of each page's current legacy detail-patch bounds, as fractions (0..1) of the page. Page views report on build (only while pdfDebugPaintDetailBounds is on); the thumbnail overlay draws them so the strip shows where each page's patch sits. Same microtask coalescing as PdfLivePageRegistry - reports arrive mid-build.
- PdfDiffChange
- A single navigation stop in the diff - a text hunk on a page, or a whole inserted/removed page. Carries the page-space bounds on each side so a side-by-side view can frame both panes and an overlay can frame one.
- Lists every change in a PdfComparisonController, grouped by page - tap to jump, mirroring PdfSearchResultsPanel's shape. The inner edge is draggable.
- PdfDigitalSignatureIdentity
- A certificate-backed identity used to create a cryptographic PDF signature.
- PdfDocument
- A PDF document with page-level semantics on top of the COS layer.
- PdfEditingController
-
An editing session over a PDF document: applies edits through
PdfEditor, owns the resulting document revisions, and carries the UI state of the editing tools (active tool, color, pending ink strokes, selected annotation). - PdfEditingInteractionHost
- The viewer-owned services an editing interaction may request.
- PdfEditingInteractionSession
- Stable event → state/effect surface for editing gestures.
- PdfEditingInteractionState
- Immutable diagnostic view of PdfEditingInteractionSession.
- PdfEditingPreferences
- Editing-UI preferences, persisted on the local device.
- PdfEditingToolbar
- A ready-made toolbar for PdfEditingController.
- PdfEditorFeatures
- Which pieces of chrome a PdfEditorView shows. Everything defaults on; turn features off rather than rebuilding the layout by hand.
- PdfEditorView
- A drop-in PDF editor: the PdfViewer with every editing tool wired up - header with search and panel toggles, thumbnail/annotation/ properties panels, and the bottom editing toolbar. For a view-only widget, use PdfReader.
- PdfFontMenuButton
- A compact button showing the current font that opens showPdfFontMenu.
- PdfFormFieldStyle
- The text styling of a form text field, read from its /DA, /Q and /Ff - what the form-field style controls reflect and edit (PdfEditingController.selectedFormFieldStyle).
- PdfHttpByteSource
- A PdfByteSource that reads a remote PDF over HTTP(S), using Range requests when the server supports them and transparently falling back to a single full download when it does not.
- PdfIdentityStore
-
Persistence for one-tap
PdfSigningIdentitys (seePdfSigningIdentity.generate). An identity is stored by a caller-chosenidas its PEM (toPem()), which carries the unprotected private key - so the production backend, SecureIdentityStore, keeps it in the platform Keychain/Keystore rather than in preferences. - PdfImageCache
- A process-wide cache of decoded image XObjects, so repeat renders of a page reuse the already-decoded ui.Image instead of re-running the codec. The same image is decoded once and shared by every render path - the on-screen page, its thumbnail, the fast-scroll preview, the eyedropper sampler, and re-renders after a zoom/page-colour/annotation change - for the life of the document.
- PdfInkSignature
- A hand-drawn signature, stored device-side and stamped onto pages as an Ink annotation (PdfEditingController.placeSignature).
- PdfLinkTarget
-
Where a hyperlink created by the link tool points: either an external
PdfLinkTarget.uri (a web address,
mailto:, or app scheme) or an in-document jump to a PdfLinkTarget.page (a whole-page fit) or a more specific PdfLinkTarget.destination (a position, zoom, or rectangle). - PdfLivePageRegistry
-
Debug registry of the page indices with a live page-view state (created
in
initState, removed ondispose). Only the active document's viewer builds page views, so indices are unambiguous. Feeds pdfDebugShowRenderWindow; maintained always (a set add/remove per page lifecycle is noise) so the overlay is truthful the moment it is enabled. - PdfLiveRasterBudget
- Process-wide budget over the rasters live page views hold simultaneously.
- PdfLiveRasterHolder
- A live page whose GPU/decoded raster memory is counted against the global PdfLiveRasterBudget. Implemented by the page view's state.
- PdfMeasurementScale
- A measurement calibration the editing UI carries: how many real-world units one PDF point represents, the unit label, and the display precision. Persisted in PdfEditingPreferences so a drawing's scale survives reopening the file.
- PdfMoveDragPreview
- A single-selection move drag's floating preview.
- PdfOcrEngine
- A pluggable OCR engine: given a rasterized page, returns recognized text runs positioned in PDF user space.
- PdfOcrPageImage
- A rasterized page handed to a PdfOcrEngine, with the geometry to map pixel boxes back to PDF user space.
- PdfOcrRasterizer
- Produces the page raster handed to a PdfOcrEngine.
- PdfPageClipboard
- A clipboard for whole PDF pages, shared across documents: copy or cut pages in one PdfEditingController's thumbnail view, then paste them into the same document - or into a different open document tab, since every controller shares the process-wide instance by default.
- PdfPageColorSampler
- Pixel access to a page rendered once, for repeated color sampling - the eyedropper's live preview follows the pointer, and re-rendering per event would be far too slow.
- PdfPageComparison
- Compares rendered PDF pages and builds diff images.
- PdfPageDiff
-
A page-pair comparison: the pixel diff plus the changed regions in each
page's own PDF coordinate space, ready for
showRectnavigation. - PdfPageExport
- Exports PDF pages to PNG/JPEG image bytes.
- PdfPageGeometry
- Converts between a page's PDF user space (origin bottom-left, y up, points) and the view space of the widget displaying it (origin top-left, y down, logical pixels), including the page's /Rotate.
- PdfPageLayout
- How PdfViewer arranges the document's pages.
- PdfPageNumberField
- The classic "page 3 / 12" indicator, with the page number editable: type a number and press enter to jump there.
-
PdfPageObjectCache<
V> - A bounded, least-recently-used cache keyed by page index.
- PdfPagePair
- One aligned page pair.
- PdfPagePreviewCache
- Low-resolution page previews shown while a page's full render is pending - most visibly during fast scrolling, when PdfPageView holds the (UI-thread) first interpretation of pages flying past and would otherwise show blank paper.
- PdfPagePreviewFrame
- One owned preview clone plus the quality metadata needed to promote a live page without accidentally downgrading it when an LRU eviction occurs.
- PdfPagePreviewLodPolicy
- Memory and background-work policy for the middle steps in the page-preview ladder.
- PdfPagePreviewLodStats
- Snapshot of the preview pyramid's retained working set.
- PdfPageRasterCachePolicy
- Memory policy for full-resolution rasters of pages the user has visited.
- PdfPageRasterGeometry
- The resolution and physical pixel size a page raster is baked at.
- PdfPageRasterSignature
- Everything that changes the pixels of a baked full-resolution page raster.
- PdfPageRasterWarmPolicy
- Whether - and how far ahead - the viewer spends idle time baking exact, display-sized page rasters for pages the user has not visited.
- PdfPageRasterWarmStats
- A snapshot of what the idle full-raster warm and the exact-raster cache have actually done - the diagnostic counterpart to PdfPageRasterWarmPolicy.
- PdfPageRenderer
- Rasterizes PDF pages.
- PdfPageRenderIntent
- The page and viewport state that determines what pixels a page view needs.
- PdfPageRenderPlan
- Immutable display inputs for rendering a page.
- PdfPageRenderScheduler
- PdfPageRenderSession
- Owns page-render identity, invalidation, scheduling, and result freshness.
- PdfPageRenderTransition
- Actions required when a page render session receives a new intent.
- PdfPageSurfaceRegion
- A y-down page-space slice painted into a worker-owned browser surface.
- PdfPageSurfaceSession
- A browser-owned page canvas bound to one render worker.
- PdfPageView
- Displays a single PDF page, rendered natively in Dart.
- PdfPanelDragFeedback
- The chip that follows the pointer while a panel is being redocked or dragged onto another panel to form a tab group.
- PdfPanelDragScope
-
Ambient wiring that lets a docked panel's move handle drive the shell's
drag-to-redock affordance.
PdfShellPanelLayoutprovides it around the panels; a panel's PdfSidebarPanelGeometry.moveHandle reads it. Absent when a shell wires no redocking - then panels render no move handle. - PdfPanelToggleButton
- One square toggle in the search panel's control row: a compact icon or short glyph ("Aa", ".*") that lights up when selected.
- PdfPencilInteraction
- Bridges the Apple Pencil's hardware double-tap gesture to an editing action - by default toggling the eraser on the attached controller, but only when the user's iOS setting asks for a tool switch.
- PdfPerfLog
- Lightweight, frame-gated performance log for diagnosing scroll/render hangs on heavy documents.
- PdfPerformanceController
- Owns adaptive state for one shell/viewer and exposes diagnostics.
- PdfPerformanceDiagnostics
- Snapshot suitable for a diagnostics panel or support log.
- PdfPerformanceEnvironment
- Stable inputs known when a document worker is opened.
- PdfPerformanceMode
- Fixed performance settings or an adaptive policy with a worker ceiling.
- PdfPerformancePolicy
- Deterministic policy functions, split from the controller for direct tests.
- PdfPerformanceSample
- One synthetic or observed performance sample. Durations are optional so callers can feed the signals they own without manufacturing the rest.
- PdfPerformanceTuning
- Runtime knobs selected by PdfPerformanceController.
- PdfPixelDiff
- The pixel-level result of comparing two equal-size RGBA rasters.
- PdfPlatformFont
-
A font discovered on the host platform (e.g. an OS-installed family),
offered as a font-menu choice. The editor can't read font files itself
(
dart:iois banned inlib/so the package keeps running on the web), so the host app discovers these and registers them in pdfPlatformFonts: a label, the engine font family to preview the menu entry with (optional) and a lazy byte loader called only when the font is chosen - its outlines then embed into the document so the text renders everywhere. - PdfPooledRenderWorker
- Fans record calls across a fixed set of platform workers so up to N pages decode at once instead of one at a time. A single worker serializes every page; on a document whose sheets are each a multi-second image decode that makes the tail crawl. Spreading the work across a pool drains it ~N× faster - the visible burst on load and the background prefetch alike.
- PdfProgressiveSourceBuilder
- Builds a viewer subtree progressively from an asynchronous PdfByteSource.
- PdfRasterCache
-
Persists low-resolution page rasters to a
PdfDiskCacheso a document reopened in a later session shows soft page content immediately - instead of blank paper - while the (heavy, twice-over-the-content- stream) full render computes. - PdfRasterCacheStats
- Counters for the persistent full-raster tier: whether it is paying for itself, and what it costs.
- PdfRasterProbe
- Measures one rasterize call: its wall duration AND how many rasters were in flight alongside it.
- PdfReader
- A drop-in, view-only PDF widget: the PdfViewer plus a slim header with search, a page-number field, view options, and a navigational thumbnail sidebar. No editing - for the full editor, use PdfEditorView.
- PdfReaderFeatures
- Which pieces of chrome a PdfReader shows. Everything defaults on; turn features off rather than rebuilding the layout by hand.
- PdfReflowBackend
- Drives a PdfViewer and reports its state: current page, zoom, and search results. Listeners fire on any change. The subset of viewer navigation a text reading view (PdfReflowView) implements so the shared PdfViewerController can drive it - page jumps, the visible-region indicator, and saved-position capture/restore - while no page PdfViewer is mounted.
- PdfReflowView
- A text-first view of a PDF document.
- PdfRegionClipState
- PdfRegionReplayUnit
- PdfRendererOcrRasterizer
- OCR rasterizer backed by PdfPageRenderer.renderImage.
- PdfRenderPhaseBudget
- Per-phase upper bounds for a PdfRenderTrace, in microseconds.
- PdfRenderTrace
- One end-to-end, per-phase record of a single page render, spanning both isolates.
- PdfRenderWorker
- Records a PDF page's interpreter callbacks into a portable command buffer OFF the UI thread, so the dominant render cost - the content-stream parse and interpreter walk - stops blocking frames while scrolling.
- PdfRetainedScene
- A page retained as a replayable scene: the recorded interpreter command buffer plus its decoded images, both produced exactly once in record.
- PdfRetainedSceneHandle
- A pinned reference to a complete retained page scene.
- PdfScaleDialog
- The scale-calibration dialog shown by showPdfScaleDialog. The user expresses the drawing's scale as "1 inch on the page equals N real units" - the most common way drawing scales are quoted - or taps "Calibrate" (when onCalibrate is set) to measure a known length on the page instead.
- PdfSceneBuildTiming
- Mutable carrier for the image-decode half of a PdfRetainedScene.fromCommands build, so the perf log can split the render 'build' phase into decode vs canvas-call construction without PdfRetainedScene.fromCommands growing a second return channel. The caller allocates one only while PdfPerfLog.enabled - an ordinary render never pays for it.
- PdfScrollbar
- The viewer-style scrollbar: a light thumb with a dark outline over a faint track scrim - always visible while the content overflows, widening on hover, draggable from the first pixel, and jumping (then dragging) on a track grab. PdfViewer paints it outside the zoom transform so it keeps its place and size at any zoom, and the sidebars mount the same bar over their lists so every scrollbar in the chrome looks and behaves alike. Colors follow PdfViewerThemeData.scrollbar.
- PdfScrollbarMarker
- A labelled location on a PdfScrollbar track.
- PdfScrollbarThemeData
- Colors for the viewer-style scrollbar (PdfScrollbar in the viewer and both sidebars). Null fields fall back to the stock palette - a light capsule with a dark outline, chosen to read against the dark canvas, white pages, and light or dark panel surfaces alike.
- PdfScrollMetrics
- A read-only snapshot of a PdfViewer's scroll state along its main layout axis, enough to drive a custom scroll indicator or page scrubber without reaching into the viewer's private scroll controller. Read it from PdfViewerController.scrollMetrics (or the PdfScrollIndicatorBuilder), and listen to PdfViewerController.viewportChanges to know when to re-read it.
- PdfSearchField
- A compact document-search field: a slim text box with the match count, previous/next, and clear riding alongside - small enough for an app bar.
- PdfSearchOptions
- How a document search matches text: case sensitivity, whole-word boundaries, and regular-expression mode. Held by PdfViewerController.searchOptions; the search field and results panel expose them as toggle controls.
- PdfSearchResult
- One search hit with the text around it, ready for a results list like PdfSearchResultsPanel.
- PdfSearchResultsPanel
- A side panel listing every search hit with its surrounding text, grouped by page - tap one to jump there.
- PdfSelectedContentImage
- A selected page-content image exported by the Content tool.
- PdfSidebarCloseButton
-
A compact close (×) button for a docked sidebar panel's header - the
desktop counterpart of the bottom sheet's close button (which the
sheet chrome supplies on its own). A panel renders this in its header
only when the host wires an
onCloseand the panel is docked, not a sheet. - PdfSidebarMoveHandle
- The grab handle a docked panel shows in its header: drag it onto another edge's drop zone to redock the panel. Renders nothing when no PdfPanelDragScope is in scope (the shell wires no redocking).
- PdfSidebarPanelFrame
- Shared docked/bottom-sheet frame for sidebar panels.
- PdfSidebarPanelGeometry
- Geometry and shared chrome supplied to a sidebar panel's content builder.
- PdfSidebarResizeGrip
- The draggable divider on a sidebar's inner edge: an invisible 8px hit strip with a hairline down the middle that thickens and tints on hover and while dragging. Reports width deltas already signed toward growth, whichever side the panel is docked on. Used by the left/right docks and by the comparison navigator.
- PdfSignatureDialog
- A dialog with a drawing pad for capturing a signature: draw with mouse, finger, or stylus (pressure is recorded and rendered as variable width, like the ink tool), pick an ink color, clear, done.
- PdfSnapshot
- A region of a page captured by the Snapshot tool (PdfEditTool.snapshot)
- PdfSnapshotClipboard
- A clipboard for the Snapshot tool's captured vector region, shared across documents: capture a region in one PdfEditingController, then paste it back as sharp vector graphics into the same document - or into a different open document tab, since every controller shares the process-wide instance by default.
- PdfSourceLoadOptions
-
Tuning knobs for
openCosDocumentFromSource. The defaults suit HTTP Range loading: a few KB probes for the header, ~64 KB windows for the tail and each xref section, and coalescing of nearby object ranges so densely packed bodies fetch in one request instead of thousands. - PdfStampEditorDialog
- The stamp creation dialog behind showPdfStampEditor: caption field, color choice, and a live preview matching the placed appearance.
- PdfStampPickerDialog
- The stamp picker dialog behind showPdfStampPicker.
- PdfStampPreview
- Renders a stamp the way it will look on the page: bold caption inside a rounded border, both in the stamp's color.
- PdfStampTemplate
- Editable vector template for a reusable rubber stamp.
- PdfStampTemplateComponent
- PdfStripDetail
- One combined deep-zoom worker result.
- PdfStyledTextEdit
- The result of the styled-text editor (showPdfStyledTextPrompt): the new text plus the style overrides to apply to it.
- PdfTakeoffPanel
- A compact takeoff register: the per-tool running totals over the live document, one row per measurement group (bucketed by /Takeoff label), with its kind, item count, and accumulated real-world total.
- PdfThumbnailDropController
- Bridges the host's native file drag-and-drop (desktop_drop, the web's drop events, …) to the thumbnail panels, so a PDF dragged in from the desktop can be dropped at a chosen position in the page order instead of only being appended.
- PdfThumbnailSidebar
- A panel of page thumbnails: tap one to jump there, drag a tile up or down to reorder pages (with a mouse just drag; on touch, long-press first so the list still scrolls), the per-tile button deletes a page (the last remaining page cannot be deleted), and the strip's footer appends a blank page. Right-clicking a tile (secondary tap) opens a page context menu - rotate, duplicate, copy/cut/paste (a shared page clipboard, so pages copied here paste into a different document tab), insert a blank page before or after, export (when onExportPages is given), delete - that acts on the strip's selection when the tile belongs to it. Copy/cut/paste are also bound to ⌘/Ctrl+C/X/V, and Delete/Backspace removes the strip's selection (or the keyboard/current page when nothing is selected). All of this (export aside) needs allowPageEditing.
- PdfThumbnailView
- A dedicated, full-area page thumbnail grid - the same page controls as PdfThumbnailSidebar (click to select a page, double-click to open it, shift/⌘-click multi-select with a bulk-action bar, per-tile rotate/delete, drag to reorder, the page-actions menu, and the Add-page footer), laid out as a reflowing grid whose tile size the header's size control changes. Use it as a page-organizer view in place of the page viewer.
- PdfTile
- A retained tile image plus the page-point region it covers and the bucket it belongs to. Owned by the store's cache; disposed on eviction.
- PdfTileBudgetStatus
- Byte-budget admission decision for one exact-bucket visible tile set.
- PdfTileKey
- The full cache key of a single tile.
- PdfTileLayer
- Draws a page's tile pyramid over its visible region.
- PdfTilePageIdentity
- Everything about a page's visual state that changes what a tile should contain: the page slot and its epoch/content/destructive stamps (from PdfPageRenderIntent) plus the display plan (paper color, annotations, rotation, from PdfPageRenderPlan). Two identities that compare equal may share tiles; any difference is a distinct key so stale pixels never surface.
- PdfTilePersistence
- Optional persistent backing for the LoD pyramid.
- PdfTilePlacement
-
One
drawImageRecta PdfTileView asks the painter to issue: src pixels of image scaled into destFraction (0..1 of the page rect). - PdfTileRasterBackend
- Creates a scene-scoped renderer for deep-zoom tiles or tile slabs.
- PdfTileRasterDiagnostics
- Bounded, always-on page/tile routing diagnostics for support exports.
- PdfTileRasterScheduling
- Optional scheduling hints implemented by tile sessions with non-Canvas submission costs.
- PdfTileRasterSession
- Scene-lifetime resources used to rasterize many tile regions.
- PdfTileStore
- The tile pyramid. Instantiable (tests, an isolated page) with a shared process-wide default (instance) so one budget spans every page, replacing the unbudgeted per-page detail patch and image retention.
- PdfTileView
- The synchronous result of PdfTileStore.viewFor: the tiles to composite for the requested viewport right now, plus whether every visible tile was available at the exact bucket (complete = no upscaled fallback in play).
- PdfTileZoomLadder
- The discrete ×√2 (or ×2) pixel-ratio ladder tiles are rastered on.
- PdfToolShortcut
- A single keyboard shortcut for arming an editing tool: a trigger key, optionally "extended" with Shift.
- PdfViewer
- A scrolling, zoomable PDF viewer.
- PdfViewerController
- PdfViewerTheme
- Provides a PdfViewerThemeData to every dart_pdf_editor widget below it (the viewer, its scrollbars, the sidebars' scrollbars, and the editing overlay).
- PdfViewerThemeData
- Visual styling for PdfViewer and its companion widgets - the scrollbars, text selection and search highlights, and the editing overlay's selection chrome. Every field is optional; nulls keep the stock look. Widget-level parameters (PdfViewer.backgroundColor) win over the theme.
- PdfViewport
- A resolution-independent snapshot of a PdfViewer's scroll position and zoom - enough to reopen the same document where the user left it.
- PdfViewSync
- A snapshot of a viewer's scroll position and zoom, for mirroring one PdfViewer onto another - the comparison view's synchronized panes. Read PdfViewerController.viewSync, hand it to another controller's PdfViewerController.applyViewSync.
- PdfWorkerRevisionDelta
- The byte-level shape of one editor revision transition (an edit, undo, or redo), consumed by the shell to feed the render worker's incremental in-place update instead of restarting it. See PdfEditingController.lastRevisionDelta.
- SecureIdentityStore
-
A PdfIdentityStore backed by the platform Keychain/Keystore via
flutter_secure_storage, so the private key never lands in plaintext preferences. Each identity's PEM is stored under'$keyPrefix$id', and an index of ids is kept under a reserved key so ids can enumerate them.
Enums
- PdfColorFormat
- The value-entry formats PdfColorPicker can show: hex (the default), RGB (0–255), HSL (degrees and percentages), and CMYK (percentages - a naive device conversion for entry and display; the committed color is still RGB, no color management is applied).
- PdfComparisonMode
- How a PdfComparisonView presents the two documents.
- PdfContextMenuTarget
- What a context menu request acts on - resolved by the viewer before the gesture is handed to the host, so the host never has to re-run a hit test.
- PdfDiffChangeKind
- What a PdfDiffChange is.
- PdfDiffStyle
- How a diff map colors its pixels.
- PdfDockablePanel
- The panels a shell can rearrange between docks. Doubles as the payload dragged from a move handle onto a drop zone and the identity a shell maps to the panel's persisted PdfPanelDock.
- PdfEditingInteractionEffect
- Last externally relevant effect produced by a transition.
- PdfEditingInteractionIntent
- The gesture intent currently owned by an editing page.
- PdfEditingInteractionPhase
- Lifecycle of the current interaction.
- PdfEditTool
- The annotation tools a PdfEditingController can arm.
- PdfEditToolGroup
-
A tool type - one dock group in PdfEditingToolbar. Pass a subset
to PdfEditingToolbar.groups (or PdfEditorFeatures.toolGroups) to
hide whole groups: e.g.
{PdfEditToolGroup.select, PdfEditToolGroup.markup}shows only the Select and Markup groups. - PdfFormFieldKind
-
The field kinds the form tool can create (and convert fields to) -
the subset of
PdfFieldTypewith creation support inPdfEditor. - PdfLineStyle
-
The border line style for shape and line annotations: solid, or one of
a few dash patterns. Maps to a PDF
/BS /Ddash array scaled to the pen width;PdfAnnotation.borderDashreads the array back. - PdfMarkupKind
- Text-markup kinds for PdfEditingController.addMarkup.
- PdfPagePairKind
- How two documents' pages line up.
- PdfPagePreviewLod
- The progressive page-preview levels below the final display raster.
- PdfPageRasterWarmMode
- How much of a document the viewer rasterizes ahead of navigation while it is genuinely idle.
- PdfPanelDock
- Which edge of the content area a dockable panel is attached to.
- PdfPencilTapAction
-
The double-tap action the user selected in iOS Settings → Apple Pencil,
reported by
UIPencilInteraction.preferredTapAction. The native side forwards it with every gesture so the Dart policy - not the runner - decides what to do, honoring the user's choice (notably ignore, when they turn the gesture off). - PdfPerformancePlatform
- Coarse runtime family used by the adaptive render policy.
- PdfPerformanceTier
- The current auto-policy posture. Exposed in diagnostics and tests.
- PdfRasterDiskFormat
- Serialized representation of a full-resolution page raster on disk.
- PdfRasterFormat
- The raster encodings PdfPageExport can produce.
- PdfRenderDeviceMode
- Which device family PdfPageRenderer.renderImageWithPlan paints with.
- PdfRenderMotionClass
- Paces the first interpretation of PDF pages so a single frame never runs more than one synchronous content-stream walk.
- PdfSidebarSide
- Which side of the viewer a sidebar panel's resize grip belongs to. Its grip rides the opposite (inner) edge - the one facing the viewer. Kept as the horizontal-only orientation the grip and the comparison navigator still speak; new placement code uses PdfPanelDock.
- PdfSignatureIdentityError
- Why PdfDigitalSignatureIdentity.fromFiles rejected the chosen files.
- PdfStampDateFormat
-
Date formats used by the built-in
{{date}}and{{datetime}}stamp template fields. - PdfStampTemplateComponentType
- PdfStampTimeFormat
-
Time formats used by the built-in
{{time}}and{{datetime}}stamp template fields. - PdfStandardFont
- The standard one-byte fonts the editors write text with - the bold, italic, and bold-italic variants of a sans-serif, serif, and monospace pick from the PDF base-14 set, which every viewer renders without embedding.
- PdfStandardFontFamily
- The three base-14 type families the editors write text with - a sans-serif, serif, and monospace pick that every viewer renders without embedding. The bold/italic variants of each are individual PdfStandardFont values; this is the axis the UI's family picker selects, orthogonal to the bold/italic toggles.
- PdfThumbnailDropEdge
- Which edge of a page tile an insertion marker hugs. The docked strip stacks tiles vertically (top/bottom); the page grid flows them along the reading direction (left/right).
- PdfViewerFit
- How PdfViewer zooms the document when it first appears.
Extensions
- PdfOcrApply on PdfEditor
- Running an PdfOcrEngine and writing its result onto a page.
Constants
- defaultPdfRenderWorkerCacheBudgetBytes → const int
- Default decoded-image command-buffer cache budget for one render worker.
- defaultPdfRenderWorkerCacheMaxEntries → const int
- Default maximum number of records the caching worker retains.
- defaultPdfRenderWorkerCacheMaxRetainedCommands → const int
- Default maximum number of command slots retained by the main-side render record cache.
- defaultPdfRenderWorkerPoolSize → const int
- Default number of platform workers PdfRenderWorker.start fans page records across.
- defaultPdfRenderWorkerScriptUrl → const String
-
The package-asset URL of the Web Worker script shipped in the optional
dart_pdf_editor_assetspackage. - defaultPdfViewerPageObjectCacheMaxEntries → const int
- Default maximum number of per-page objects the viewer keeps in each of its page-keyed object caches (extracted text, annotation lists, form-field rects).
-
defaultStyledTextPalette
→ const List<
Color> - The quick-pick colours the styled-text dialog offers by default - the same set the toolbar uses. Overridden by the host's own palette when the toolbar opens the dialog.
- kPdfDiffChannelTolerance → const int
- Default per-channel difference treated as identical, matching the Ghent/PDF.js harnesses.
-
pdfEditToolShortcuts
→ const Map<
PdfEditTool, PdfToolShortcut> - Default keyboard shortcuts for arming the editing tools.
- pdfRenderWorkerPoolMinPages → const int
- Documents with at least this many pages use a PdfPooledRenderWorker via startPdfRenderWorker; shorter ones use a single worker because extra startup and memory usually cost more than the parallelism saves.
Properties
- detectedPdfPerformancePlatform → PdfPerformancePlatform
-
The current runtime family, however the platform will admit to it.
no setter
-
pdfBundledFonts
↔ List<
PdfBundledFont> -
The fonts offered in every font menu without a file picker, on top of the
base-14 families, the document's own fonts, and the platform fonts.
getter/setter pair
- pdfDebugGestureLog ↔ void Function(String message)?
-
Sink for the viewer's touch/gesture diagnostics. Null (the default) means
the viewer emits nothing and pays only a single null-check at each gesture
decision point. A host's developer tools sets it to capture which pan/zoom
path a touch actually took - the signal for "panning does nothing while
zoomed" reports that never reproduce off-device. Set back to null to stop.
getter/setter pair
-
pdfDebugPaintDetailBounds
→ ValueNotifier<
bool> -
Paints diagnostic borders on the deep-zoom detail surfaces: every tile
placement in a PdfTileLayer (green for exact-bucket tiles, orange for
upscaled coarser fallbacks) and the legacy single detail patch (purple).
Shows what sharpens the visible slice, and from which source.
final
-
pdfDebugShowRenderWindow
→ ValueNotifier<
bool> -
Outlines, in the thumbnail strip/grid, the pages that currently hold a
live page-view state (PdfLivePageRegistry) - the lazy-list "render
window" whose retained scenes and rasters dominate per-page memory.
final
-
pdfPlatformFonts
↔ List<
PdfPlatformFont> -
Platform (OS-installed) fonts offered in every font menu, on top of the
base-14 families and the pdfBundledFonts. The editor library can't
enumerate the host's fonts, so a host app fills this once at startup
(see the example/app's
loadPlatformFonts) and every showPdfFontMenu picks it up by default. Empty until a host populates it.getter/setter pair - pdfRenderWorkerCacheBudgetBytes ↔ int
-
Decoded-image command-buffer cache budget for each render worker.
getter/setter pair
- pdfRenderWorkerCacheMaxEntries ↔ int
-
Maximum number of records the caching worker retains, regardless of weight.
getter/setter pair
- pdfRenderWorkerCacheMaxRetainedCommands ↔ int
-
Maximum number of command slots retained by the main-side render cache.
getter/setter pair
- pdfRenderWorkerPoolSize ↔ int
-
How many platform workers PdfRenderWorker.start fans page records across.
getter/setter pair
- pdfRenderWorkerRecordTimeout ↔ Duration
-
How long the caching worker waits for one backend record before giving up on
that worker snapshot.
getter/setter pair
- pdfRenderWorkerReuseTranscripts ↔ bool
-
Whether newly-created web render workers reuse one image-free page
transcript across progressive record, image, detail, and strip phases.
getter/setter pair
- pdfRenderWorkerScriptUrl ↔ String?
-
On web, the URL of the compiled Web Worker script that backs the render
worker (its
main()callsrunPdfRenderWorker; see the web-only librarypackage:dart_pdf_editor/render_worker_web.dartanddoc/render_worker_web.mdfor the build wiring).getter/setter pair - pdfViewerPageObjectCacheMaxEntries ↔ int
-
Maximum number of per-page objects the viewer retains in each page-keyed
object cache, regardless of size. See PdfPageObjectCache.
getter/setter pair
Functions
-
encodePageForVectorPrinting(
PdfPage page, {int? rotation, bool annotations = true}) → Future< Uint8List> -
Encodes
pageas a vector-print op stream (seeencodeVectorPrintPage) using the app's fulldart:ui-backed image decode, so baseline-JPEG underlays - the one image class the pure-Dart path can't turn into pixels - still reach the print stream. -
loadBundledFont(
PdfBundledFont font) → Future< Uint8List> - Loads (and caches) a bundled font's bytes, from its PdfBundledFont.loadBytes when set, otherwise from the asset bundle key.
-
loadFallbackFonts(
) → Future< List< PdfEmbeddedFont> > -
The bundled DejaVu trio (sans, serif, monospace) parsed for use as
content-edit fallbacks: when rewriting composite (/Type0) page text, a
document's own font may be subsetted and lack the glyph for a character
the user types, so these wide-Unicode faces draw it instead (the closest
serif/mono match is chosen). Loaded and cached once; a missing/corrupt
asset is skipped. Returns an empty list when pdfBundledFonts carries no
DejaVu faces (a viewer that didn't register
dart_pdf_editor_assets), which just disables composite-text fallback rather than failing. -
lookupDartPdfEditorLocalizations(
Locale locale) → DartPdfEditorLocalizations -
pdfApplyFont(
PdfEditingController controller, PdfTextFont font) → void -
Applies
fonttocontroller: it becomes the font new free text is written in (an embedded font sets PdfEditingController.activeFont; a standard family sets PdfEditingController.fontFamily) and, when a single free-text box is selected, restyles it in place too. -
pdfDefaultImageCacheBytes(
{PdfPerformancePlatform? platform, double? deviceMemoryGb}) → int - The default byte budget for the process-wide decoded-image cache (PdfImageCache) on this platform.
-
pdfDefaultLiveRasterBudgetBytes(
{PdfPerformancePlatform? platform, double? deviceMemoryGb}) → int - Platform-aware default for PdfLiveRasterBudget.maxBytes: the ceiling over the base rasters, detail patches, and retained-scene images the live pages in the scroll cacheExtent hold at once (#405).
-
pdfDefaultMeasurementUnit(
[Locale? locale]) → String -
The default real-world distance unit for
locale: feet in the imperial-system regions (the US, Liberia, Myanmar), metres everywhere else. The scale dialog passes no argument, so it follows the device region a user expects rather than the app's (possibly English-only) UI locale. -
pdfDefaultPageUnit(
[Locale? locale]) → String -
The default on-page reference unit (the ratio's left-hand side) for
locale: inches in the imperial-system regions, centimetres everywhere else. Like pdfDefaultMeasurementUnit, this follows the device region. -
pdfDefaultRetainedSceneBytes(
{PdfPerformancePlatform? platform}) → int -
The default byte budget for retained page scenes
(
PdfPagePreviewCache's retained-scene LRU) on this platform. -
pdfDefaultTileStoreDetail(
) → bool - Whether the deep-zoom tile pyramid (PdfPageView.tileStoreDetail, issue #314) is on by default. On for every platform since the budget-vs-demand guard (issues #314/#360) removed the eviction thrash a HiDPI/web view could hit: a view too dense to tile within budget now falls back to the single detail patch instead of re-rastering evicted tiles on every repaint (PdfTileStore.viewFitsBudget).
-
pdfDocumentKey(
Uint8List bytes) → String -
A stable key identifying a PDF by its content, for persisting a
per-document viewport (see
PdfReader.documentId). -
pdfEditToolGroupOf(
PdfEditTool tool) → PdfEditToolGroup -
The dock group
toolbelongs to. Mirrors the layout of PdfEditingToolbar so surfaces that list tools - the keyboard-shortcuts editor in particular - can organise them the same way the toolbar reads. -
pdfEditToolShortcutLabel(
PdfEditTool tool, {Map< PdfEditTool, PdfToolShortcut> shortcuts = pdfEditToolShortcuts}) → String? -
The display label for
tool's shortcut key (e.g.'V'or'⇧L'), or null when the tool has no bound key. -
pdfFloatingToastMargin(
BuildContext context, {double pill = 360}) → EdgeInsetsGeometry - Margin that floats a SnackBar clear of the editor's bottom chrome - the floating editing toolbar dock (and any device safe-area inset beneath it, e.g. a home indicator). Use it with SnackBarBehavior.floating so toasts never hide behind the dock:
-
pdfGpuSoftMaskOf(
Image image) → Image? -
pdfImageContentKey(
PdfImageRequest request) → Object -
Identifies
request's source image irrespective of the resolution anything decoded it at: stream identity for an XObject, a value key for an inline image (whose stream is synthesized fresh on every interpretation pass). -
pdfL10n(
BuildContext context) → DartPdfEditorLocalizations -
Resolves the editor UI's localizations for
context, falling back to English when the host app hasn't registered DartPdfEditorLocalizations.delegate - package widgets therefore work out of the box, and hosts opt into translations by adding DartPdfEditorLocalizations.localizationsDelegates to their app. -
pdfLogGesture(
String message, [String details()?]) → void -
Emits
messagethrough pdfDebugGestureLog when a host has installed one.detailsis appended lazily so its (possibly non-trivial) string only builds when logging is live. -
pdfPanelControlsRevealOnHover(
) → bool - Whether panel row controls should be revealed by mouse hover.
-
pdfPredictStrokeLead(
List< (double, double)> points, {int steps = 1, double gain = 0.9, double curvatureDamping = 0.5, double minSegment = 0.75, double maxLeadFactor = 1.6, double maxTurn = 2.0}) → List<(double, double)> - Forward-extrapolates a short speculative "lead" beyond the last sampled point of an in-progress ink stroke, to mask the input+render latency between the pen tip and the painted line - the pure-geometry analogue of PencilKit's predicted touches (which read the OS's hardware predictor). Display only: the returned points are drawn ahead of the stroke but never enter the committed /InkList.
-
pdfRenderCommandBounds(
PdfRenderCommand command) → PdfRect? -
pdfRenderPathBounds(
PdfPath path) → PdfRect? -
pdfResolveStampTemplateText(
String text, Map< String, String> values) → String -
Resolves
{{field}}placeholders in stamp text fromvalues. -
pdfShouldWarmThumbnails(
int pageCount, {bool? web}) → bool - Whole-document thumbnail warming policy.
-
pdfThumbnailDropIndexAt(
{required BuildContext? panelContext, required Map< int, GlobalKey< tileKeys, required int pageCount, required Axis axis, required Offset globalPosition, bool reversed = false}) → int?State< >StatefulWidget> > -
The insertion index a drop at
globalPositionlands on for a panel whose tiles are laid out alongaxis, or null when the point is outside the panel. -
rasterizePdfForPrinting(
PdfDocument document, {double dpi = 200, int jpegQuality = 85}) → Future< Uint8List> -
Flattens
documentinto a fresh, image-only PDF: every page is rendered to a bitmap with this package's own engine and re-emitted as a single full-page JPEG. -
rasterizeThumbnail(
{required PdfEditingController controller, required int pageIndex, required Color pageColor, required bool annotations, required int pixelWidth, required PdfRenderWorker? worker, int priority = 2, bool skipIfWorkerDeclines = false, bool deferUiWork()?, String reason = 'tile', PdfRasterCache? disk}) → Future< Image?> -
Interprets
pageIndexand rasterizes it to a tile-resolution image, off the UI thread viaworkerwhen one is active and locally otherwise. Returns null when the page has no area or can't be rendered. -
readSourceFully(
PdfByteSource source, {void onProgress(int received, int? total)?, int chunk = 8 << 20, PdfCancelToken? cancelToken}) → Future< Uint8List> - Reads a whole PdfByteSource into one contiguous buffer, reporting progress as it goes.
-
showCreateSigningIdentityDialog(
BuildContext context, {PdfIdentityStore? store, String? storeId}) → Future< PdfSigningIdentity?> -
Shows the "Create signing identity" dialog: the user enters a name (and
optionally an email and organization), and a self-signed P-256
PdfSigningIdentityis minted offline viaPdfSigningIdentity.generate. -
showPdfAddLinkDialog(
BuildContext context, {required int pageCount, required int currentPage, String initialUrl = ''}) → Future< PdfLinkTarget?> - The default showPdfAddLinkDialog: a small Material dialog that collects a hyperlink target - an external web address, or a page in this same document. Returns the chosen PdfLinkTarget, or null if the user cancels or leaves the field empty.
-
showPdfAnnotationMenu(
{required BuildContext context, required Offset position, required PdfEditingController controller, required int pageIndex, PdfAnnotationMenuBuilder? customActions, (double, double)? pagePoint, (int, int)? unlockTarget}) → Future< void> -
Shows the annotation context menu at
position(global coordinates) forcontroller's current selection: copy/cut/apply-to-pages/paste, bring to front, send to back, add/remove node (a single /PolyLine or /Polygon, whenpagePointis known), delete, then whatevercustomActionsadds. Resolves when the menu closes, after the picked action ran. -
showPdfCalibrationLengthDialog(
BuildContext context, {String? initialUnit}) → Future< (double, String)?> -
Asks how long the just-drawn reference segment is in the real world,
returning
(realLength, unitLabel)or null when dismissed. Used by the draw-a-segment calibration flow after the user releases the drag.initialUnitpre-selects the unit (defaults to the device region's). -
showPdfColorPicker(
BuildContext context, {required Color initial, PdfColorFormat initialFormat = PdfColorFormat.hex, ValueChanged< PdfColorFormat> ? onFormatChanged, List<Color> recentColors = const [], List<Color> documentColors = const []}) → Future<Color?> - Shows PdfColorPicker in a dialog. Returns the chosen color, or null when dismissed.
-
showPdfColorProcessingDialog(
BuildContext context, {required PdfEditingController controller, required PdfEditingPreferences preferences}) → Future< int?> - Shows the document color-processing dialog and returns the number of page-content color operators rewritten, or null when cancelled.
-
showPdfDepthDialog(
BuildContext context, {String? unitLabel}) → Future< double?> -
Asks for the extrusion depth of a volume measurement, in the scale's
distance unit (
unitLabel, shown as a suffix). Returns the depth, or null when dismissed. Used by the volume tool after the footprint polygon is drawn. -
showPdfDialog<
T> ({required BuildContext context, required WidgetBuilder builder, bool barrierDismissible = true, Color? barrierColor, String? barrierLabel, bool useSafeArea = true, RouteSettings? routeSettings, Offset? anchorPoint, TraversalEdgeBehavior? traversalEdgeBehavior, bool fullscreenDialog = false, bool? requestFocus, AnimationStyle? animationStyle}) → Future< T?> - Shows a Material dialog inside the current Flutter view.
-
showPdfFontMenu(
{required BuildContext context, required PdfEditingController controller, PdfFontPicker? fontPicker, List< PdfBundledFont> ? bundled, List<PdfPlatformFont> ? platformFonts, List<PdfEmbeddedFont> ? documentFonts, PdfTextFont? currentFont, void onSelected(PdfTextFont font)?}) → Future<void> -
Pops a font menu anchored at
context's widget and applies the pick: the standard families, the fonts already embedded in the open document (documentFonts, defaulting to PdfEditingController.documentFonts), thebundledfonts, the platform fonts (platformFonts, defaulting to the host-populated pdfPlatformFonts registry), then "Load font…" (when afontPickeris given). Recently-picked fonts head the list in a "Recently used" group. The search field is focused on open and the menu is searchable. Bundled, platform, document and custom fonts embed into the document so the text renders everywhere. -
showPdfFormFieldMenu(
{required BuildContext context, required Offset position, required PdfEditingController controller, required String fieldName, int? widgetIndex, PdfTextPrompt textPrompt = showPdfTextPrompt, PdfFontPicker? fontPicker, PdfFormImagePicker? formImagePicker}) → Future< void> -
Shows the form tool's field context menu at
position(global coordinates) for the field namedfieldName: rename, convert to the other creatable kinds, delete, and flatten the whole form. Resolves when the menu closes, after the picked action ran. -
showPdfPageRangeDialog(
BuildContext context, {required int pageCount, int? initialStart, int? initialEnd, String title = 'Export pages', String confirmLabel = 'Export'}) → Future< ({int end, int start})?> -
Asks the user for an inclusive page range, returning it 0-based as
(start, end)- or null when cancelled.pageCountbounds the input and seeds the default span (the whole document, unlessinitialStart/initialEndnarrow it). Fields are shown 1-based. -
showPdfScaleDialog(
BuildContext context, {PdfMeasurementScale? initial, VoidCallback? onCalibrate}) → Future< PdfMeasurementScale?> -
Asks the user for a drawing scale (
1 in on the page = N unit in the world) and returns the calibrated PdfMeasurementScale, or null when dismissed.initialpre-fills the fields. WhenonCalibrateis given, the dialog offers a "Calibrate" action that dismisses the dialog and invokes the callback (typically to arm the draw-a-reference-segment flow) instead of returning a typed ratio. -
showPdfSignatureDialog(
BuildContext context, {bool predictStrokes = true}) → Future< PdfInkSignature?> -
Shows the signature pad dialog; resolves to the drawn signature, or
null on cancel.
predictStrokesforward-extrapolates the in-progress stroke to mask input latency, exactly like the ink tool (see PdfViewer.predictStrokes); display only, never committed. -
showPdfStampEditor(
BuildContext context, {Iterable< String> fields = PdfEditingController.stampTemplateBuiltinFields, PdfImagePicker? imagePicker, PdfCustomStamp? initial}) → Future<PdfCustomStamp?> - Shows the stamp creation dialog; resolves to the new stamp, or null on cancel. Saving it is the caller's job (the picker saves through the controller).
-
showPdfStampPicker(
BuildContext context, {required PdfEditingController controller, PdfImagePicker? imagePicker, PdfStampExportCallback? onExportStamps, PdfStampImportCallback? onImportStamps}) → Future< void> -
Shows the stamp picker: choose the stamp the stamp tool places,
create a new one, or delete saved ones. Selections apply directly to
controller. -
showPdfStyledTextPrompt(
BuildContext context, {required String initial, List< Color> palette = defaultStyledTextPalette, PdfStyledFontPicker? pickFont}) → Future<PdfStyledTextEdit?> -
The default PdfStyledTextPrompt: a Material dialog that reuses the
toolbar's text-box style controls - the Bold/Italic
FontStyleToggles, a font-size slider, and aPdfColorSwatchRowfor the fill - above a text field. -
showPdfTextPrompt(
BuildContext context, {required String title, String initial = '', bool multiline = false}) → Future< String?> - The default PdfTextPrompt: a one-field Material dialog.
-
startPdfRenderWorker(
Uint8List bytes, {required int pageCount, int? workerCount, bool copySource = false}) → PdfRenderWorker -
Starts the right cached worker for a
pageCount-page document: a pooled backend when the document is long enough andworkerCount(or the global pdfRenderWorkerPoolSize fallback) asks for parallelism, otherwise a single platform worker.copySourceis forwarded to PdfPooledRenderWorker; it defaults to false here because every caller of this entry point starts the worker over a document image whose bytes don't change under it (the read-only reader, or the edit session's grow-only buffer, which is replaced rather than mutated). Skipping the pool's defensive snapshot saves a full-document allocation per worker generation - the single-worker branch never copied either. -
thumbnailKey(
PdfEditingController controller, int pageIndex, Color pageColor, bool annotations, int pixelWidth) → String - The shared-cache key a page's thumbnail is stored under: page index, its render stamp (so an edit re-renders only the pages it touched), the paper color, the raster width bucket, and whether annotations are drawn. The tile, the grid cell, and the background warm all derive the same key, so they reuse one another's rasters.
Typedefs
- PdfActionHandler = void Function(PdfAction action, PdfAnnotation annotation)
-
Signature for PdfViewer.onAction: the user activated
annotation(tapped a link or form button) and the viewer doesn't handle itsactionitself. - PdfAnnotationEditPredicate = bool Function(PdfAnnotation annotation)
- Host veto over which annotations the editing UI may change - see PdfEditingController.canEditAnnotation.
-
PdfAnnotationMenuBuilder
= List<
PdfAnnotationMenuItem> Function(BuildContext context, PdfAnnotationMenuRequest request) - Builds the host's extra context-menu entries for the current selection. Returning an empty list adds nothing; the stock entries always come first, with a divider before the custom ones.
- PdfAnnotationTapHandler = void Function(PdfAnnotationTapDetails details)
- Called when the user taps or clicks a visible PDF annotation.
- PdfContextMenuHost = void Function(PdfContextMenuRequest request)
- Fires when the host wants to render its own context menu in place of the stock annotation/text menu. See PdfContextMenuRequest.
- PdfContextMenuRelay = void Function(Offset globalPosition, int pageIndex, {PdfAnnotation? annotation, required (double, double) pagePoint, int? slot, required PdfContextMenuTarget target})
- The page overlay's channel back to the viewer's PdfContextMenuHost: the overlay resolved the annotation itself, the viewer adds the selection and controller and builds the PdfContextMenuRequest.
- PdfEditingToolbarWidgetBuilder = Widget Function(BuildContext context, PdfEditingController controller, PdfViewerController viewerController)
- Builds a custom widget inside PdfEditingToolbar.
- PdfEditorToolbarBuilder = Widget? Function(BuildContext context, PdfEditingController controller, PdfViewerController viewerController)
- Builds the editing toolbar for PdfEditorView.
-
PdfFontPicker
= Future<
Uint8List?> Function(BuildContext context) -
Supplies a TrueType (
.ttf) or OpenType (.otf) font file the font menu's "Load font…" entry embeds for new text — typically a file picker. Return null to cancel (PdfEditingController.setCustomFont). -
PdfFormImagePicker
= Future<
Uint8List?> Function(BuildContext context, PdfFormField field) - Supplies the image a tapped push-button field should be filled with
-
PdfImagePicker
= Future<
Uint8List?> Function(BuildContext context) - Supplies the image bytes the image tool (PdfEditTool.image) inserts
-
PdfLinkPrompt
= Future<
PdfLinkTarget?> Function(BuildContext context, {required int currentPage, String initialUrl, required int pageCount}) -
Supplies the target for a link the link tool (PdfEditTool.link) or the
text-selection "Add link" action is placing. Return null to cancel.
pageCountis the document's page count andcurrentPagethe zero-based page the link is being drawn on (a sensible default for an internal jump). - PdfMoveDragPreviewCallback = void Function(PdfMoveDragPreview? preview)
-
PdfPageOverlayBuilder
= List<
Widget> Function(BuildContext context, int pageIndex, PdfPageGeometry geometry) -
Signature for PdfViewer.pageOverlayBuilder: returns widgets stacked
over one page. Use
geometryto convert PDF coordinates to view coordinates, e.g.Positioned.fromRect(rect: geometry.toViewRect(...)). -
PdfPartialRecordSink
= void Function(List<
PdfRenderCommand> partial) - Sink for progressive partial recordings (#564).
- PdfPencilTapHandler = void Function(PdfPencilTapAction action)
- Runs on every Apple Pencil double-tap, carrying the user's preferred action so a host can fully override the default eraser toggle.
- Receives a figure the reader tapped in PdfReflowView, rendered as a PNG, to save or share it (typically the platform share sheet / a save dialog). With no handler the fullscreen image viewer still opens (pan and pinch to zoom) - it just omits the share action.
- PdfScrollIndicatorBuilder = Widget Function(BuildContext context, PdfViewerController controller, PdfScrollMetrics metrics)
- Signature for PdfViewer.scrollIndicatorBuilder: builds a custom main-axis scroll indicator (a compact page number, a draggable page scrubber, a platform-styled bar) in place of the viewer's built-in scrollbar. It fills the viewer, rebuilt whenever the scroll position, zoom, or current page changes; use PdfScrollMetrics.scrollAxis to orient it - the viewer's right edge for a vertical PdfPageLayout.verticalContinuous layout, the bottom edge for a horizontal PdfPageLayout.horizontalContinuous one.
-
PdfSelectedContentImageHandler
= Future<
void> Function(BuildContext context, PdfSelectedContentImage image) - Receives a selected content image from the Content tool — typically to save, share, or download it. Return when the host export is complete.
- PdfSidebarPanelContentBuilder = Widget Function(BuildContext context, PdfSidebarPanelGeometry geometry)
-
PdfSignaturePlacer
= Future<
void> Function(BuildContext context, {required int pageIndex, required PdfRect pageRect}) -
Receives a signature box the user drew with the Signature-box tool
(PdfEditTool.signatureBox) - Acrobat/Bluebeam-style placement. The host
collects an identity and appearance (reason, location, a hand-drawn mark,
a logo backdrop) and cryptographically signs into
pageRectonpageIndexvia PdfEditingController.addKeylessSignature / addSelfSignedSignature / addDigitalSignature with aPdfSignatureAppearance(page: pageIndex, rect: pageRect, …). With no handler (PdfViewer.onPlaceSignature) the tool does nothing.pageRectis in PDF user space (points, origin bottom-left). -
PdfSnapshotHandler
= Future<
void> Function(BuildContext context, PdfSnapshot snapshot) - Receives a region captured by the Snapshot tool (PdfEditTool.snapshot)
- PdfSourceProgress = void Function(int fetched, int? total)
-
Reports progressive-load progress.
fetchedis the running total of bytes pulled from the source;totalis the document length when known. -
PdfStampExportCallback
= Future<
void> Function(BuildContext context, List<PdfCustomStamp> stamps) - Saves user-managed custom stamps somewhere outside the editor package.
-
PdfStampImportCallback
= Future<
List< Function(BuildContext context)PdfCustomStamp> ?> - Loads user-managed custom stamps from somewhere outside the editor package.
-
PdfStyledFontPicker
= Future<
PdfTextFont?> Function(BuildContext context) - Opens the app's font menu and returns the chosen font (a standard family or an embedded face), or null if cancelled. Supplied by the toolbar so the styled dialog reuses the same font picker as the rest of the editor.
-
PdfStyledTextPrompt
= Future<
PdfStyledTextEdit?> Function(BuildContext context, {required String initial, List<Color> palette, PdfStyledFontPicker? pickFont}) - Signature of the prompt the content tool uses to edit a text element's characters and its style at once. Returns null when the user cancels.
-
PdfSystemImagePasteProvider
= Future<
Uint8List?> Function(BuildContext context) - Supplies image bytes for a system clipboard paste. Return null when the clipboard does not currently carry a pasteable image. PNG and JPEG bytes are accepted (PdfEditingController.placeImage).
-
PdfSystemTextPasteProvider
= Future<
String?> Function(BuildContext context) -
Supplies plain text for a system clipboard paste, used in preference to
Flutter's Clipboard when set. Return null when the clipboard carries no
text. Exists mainly for the web, where Flutter's
Clipboard.getDatais unreliable: the host injects a reader built on the browser Async Clipboard API so ⌘V/Ctrl+V can paste text into a PdfEditTool.freeText box. -
PdfTextPrompt
= Future<
String?> Function(BuildContext context, {String initial, bool multiline, required String title}) - Signature of the prompt the editing UI uses to ask for annotation text (free text, notes, stamps). Returns null when the user cancels.
- PdfThumbnailDropResolver = int? Function(Offset globalPosition)
- Resolves the insertion index a file drop at a global position would land on inside one thumbnail panel, or null when the position isn't over it.
-
PdfTileRasterizer
= Future<
Image> Function(Rect region, double pixelRatio) -
Rasterizes one tile:
regionis the tile's bounds in page points (the y-down raster space PdfRetainedScene.rasterizeRegion takes),pixelRatiothe bucket ratio. The returned image is owned by the store. -
PdfUrlLauncher
= Future<
bool> Function(Uri uri) -
Signature for PdfViewer.onLaunchUrl: open the hyperlink
uriof a tapped /URI action. Returns whether it was opened - false hands the link back to PdfViewer.onAction so a custom scheme can still be dispatched there. - PdfWorkerPhaseTimings = PdfRenderTrace
- Worker-side accumulator for the off-thread phases of one render job.
Exceptions / Errors
- PdfHttpCancelledException
- Thrown from a PdfHttpByteSource read after its PdfCancelToken fired.
- PdfHttpException
- Thrown when the server responds in a way the source cannot use (an error status, or a body that does not match the requested range).
- PdfSignatureIdentityException
- A FormatException raised while parsing signing key/certificate files, tagged with a machine-readable code so a host can localize the message.