Flutter API reference
Generated from the package's Dart sources. For a guided introduction — adding the package, opening the editor, customizing it — start with the Flutter guide.
Package pdf_editor (import 'package:pdf_editor/pdf_editor.dart';): 33 public types and 338 members, generated from the SDK's sources at build time, so this page cannot drift from them.
- The editor —
PdfEditorMode,PdfEditorTool,PdfEditor - Customization —
PdfEditorAction,PdfEditorSignatureMethod,PdfEditorSignaturePlacement,PdfEditorStamp,PdfEditorMenuItem,PdfEditorColorScheme,PdfEditorLayoutDirection,PdfEditorLocalization,PdfEditorHandleShape,PdfEditorMarkupStyle,PdfEditorInkStyle,PdfEditorColors,PdfEditorToolDefaults,PdfEditorConfiguration - Document API —
PdfRect,PdfLayerKind,PdfShape,PdfLayer,PdfSearchMatch,PdfFormField,PdfMetadataKey,PdfFontFamily,PdfZOrder,PdfMarkupKind,PdfImageKind,PdfFormFieldKind,PdfTextResult,PdfDocumentException,PdfDocument - SDK, licensing and callbacks —
PdfEditorLicense
The editor
PdfEditorMode
enum PdfEditorModeWhich editor the document opens in.
The seven modes are identical on both platforms, but three of them are SPELLED differently in the native SDKs (.contentEditor/EDIT, .fillSign/FILL_AND_SIGN, .form/FORMS).
viewer
PdfEditorMode.viewerRead-only. No toolbar, no selection, no undo — just the document.
edit
PdfEditorMode.editContent editing: select, move, restyle and retype what is already on the page.
forms
PdfEditorMode.formsAcroForm authoring: place and configure text fields, check boxes, radios, lists, dropdowns.
annotate
PdfEditorMode.annotateText markup: highlight, underline, strikeout, squiggly.
fillAndSign
PdfEditorMode.fillAndSignSignature, text and stamp placement.
insert
PdfEditorMode.insertAdd pages, images, notes and text boxes.
draw
PdfEditorMode.drawFreehand ink and shapes.
PdfEditorTool
enum PdfEditorToolA tool to arm as the editor opens, hide, rename or reorder.
addText
PdfEditorTool.addTextimage
PdfEditorTool.imagelink
PdfEditorTool.linkinsertPage
PdfEditorTool.insertPagemultiSelect
PdfEditorTool.multiSelecthighlight
PdfEditorTool.highlightunderline
PdfEditorTool.underlinestrikeout
PdfEditorTool.strikeoutsquiggly
PdfEditorTool.squigglysignature
PdfEditorTool.signaturestamp
PdfEditorTool.stampnote
PdfEditorTool.notedraw
PdfEditorTool.drawshapeRectangle
PdfEditorTool.shapeRectangleshapeEllipse
PdfEditorTool.shapeEllipseshapeLine
PdfEditorTool.shapeLineshapeArrow
PdfEditorTool.shapeArrowformTextField
PdfEditorTool.formTextFieldformCheckBox
PdfEditorTool.formCheckBoxformRadioButton
PdfEditorTool.formRadioButtonformListBox
PdfEditorTool.formListBoxformDropdown
PdfEditorTool.formDropdownPdfEditor
abstract final class PdfEditorOpens the native editor, full screen, and waits for the user to finish.
setLicenseKey
static Future<PdfEditorLicense> setLicenseKey(String key) asyncSet your PDF-SDK license key, once, before the first open — typically in main().
The key is issued for your app's bundle identifier (iOS) and package name (Android) and is checked offline inside the SDK. Without a valid key the editor opens nothing and says why on screen.
license
static Future<PdfEditorLicense> license() asyncThe current license verdict.
refreshLicense
static Future<PdfEditorLicense> refreshLicense() asyncOnline licenses: ask the vendor's license server now and complete with the verdict afterwards (the native SDK also checks by itself at launch and when the app returns to the foreground). Offline keys complete at once.
open
static Future<String?> open(
{
required String path,
String? password,
PdfEditorMode? mode,
PdfEditorTool? tool,
PdfEditorConfiguration? configuration,
bool inPlace = false,
void Function(PdfDocument document)? onDocumentReady,
}
) asyncPresent the editor over path and complete when the user leaves it.
Returns the path of the edited PDF, or null if the user closed the editor without saving.
A path rather than the bytes, deliberately. The native SDKs hand back the whole document, and a real document is tens or hundreds of megabytes: on Android that cannot cross an Intent (Binder's ~1 MB transaction limit), and on both platforms it would be copied again through the method channel. The plugin writes the result to a file and returns where — read it with File(result).readAsBytes() if you do want the bytes.
With inPlace the edit overwrites path and that same path is returned. Otherwise the result is written in the system temporary directory and is yours to move or delete.
password is honoured on Android. On iOS it is ignored: that shell prompts for the password in its own UI instead, so an encrypted document still opens — the user is simply asked.
Throws a PlatformException whose code is bad_args, not_found, already_open, no_activity, write_failed (the edited file couldn't be written) or, on Android, unsupported (no engine for this device's ABI). A user closing the editor is not an error: that returns null.
onDocumentReady is called once the document is open, with a PdfDocument for the document the editor is SHOWING: changes appear on screen at once and the user can undo them. It stops working when the editor closes (calls then throw notFound); don't PdfDocument.close it — the editor owns it.
nativeVersion
static Future<String> nativeVersion() asyncThe native SDK's own version, which is not the host app's and not this package's.
Worth logging next to your build stamp: a crash report shows the HOST's version, so without this there is nothing in the report that identifies which engine was running.
isSupported
static Future<bool> isSupported() asyncWhether the native engine loaded. False when the app shipped without a slice for this ABI.
You do not have to check: open throws unsupported rather than failing silently. It is here so a host CAN route around the editor entirely — hide the Edit button — instead of offering a dead end.
Customization
PdfEditorAction
enum PdfEditorActionA sub-tool: a control that appears once something is selected (the property bar, the menu over the selection) or on a page in the page panel. Rename, hide and reorder them with PdfEditorConfiguration.actionTitles, hiddenActions and actionOrder.
multiSelect
PdfEditorAction.multiSelecteditText
PdfEditorAction.editTexttextColor
PdfEditorAction.textColorfont
PdfEditorAction.fonttextStyle
PdfEditorAction.textStylefontSize
PdfEditorAction.fontSizeopacity
PdfEditorAction.opacitystrokeColor
PdfEditorAction.strokeColorfillColor
PdfEditorAction.fillColorstrokeWidth
PdfEditorAction.strokeWidtheditNote
PdfEditorAction.editNotenoteColor
PdfEditorAction.noteColorresign
PdfEditorAction.resignreplaceImage
PdfEditorAction.replaceImagecrop
PdfEditorAction.cropplaySound
PdfEditorAction.playSoundlink
PdfEditorAction.linkcut
PdfEditorAction.cutcopy
PdfEditorAction.copyduplicate
PdfEditorAction.duplicatedelete
PdfEditorAction.deleteformFill
PdfEditorAction.formFillformOptions
PdfEditorAction.formOptionsformRadioGroup
PdfEditorAction.formRadioGroupformColors
PdfEditorAction.formColorsformBorderWidth
PdfEditorAction.formBorderWidthpaste
PdfEditorAction.pasterotatePageLeft
PdfEditorAction.rotatePageLeftrotatePageRight
PdfEditorAction.rotatePageRightduplicatePage
PdfEditorAction.duplicatePageinsertBlankPage
PdfEditorAction.insertBlankPagedeletePage
PdfEditorAction.deletePagePdfEditorSignatureMethod
enum PdfEditorSignatureMethodThe signature pad's tabs, for PdfEditorConfiguration.signatureMethods.
draw
PdfEditorSignatureMethod.drawtype
PdfEditorSignatureMethod.typeimage
PdfEditorSignatureMethod.imageeSign
PdfEditorSignatureMethod.eSignPdfEditorSignaturePlacement
enum PdfEditorSignaturePlacementWhere the e-Sign tab's Placement picker starts, for PdfEditorConfiguration.signaturePlacement.
bottomRight
PdfEditorSignaturePlacement.bottomRightbottomLeft
PdfEditorSignaturePlacement.bottomLefttopRight
PdfEditorSignaturePlacement.topRighttopLeft
PdfEditorSignaturePlacement.topLeftinvisible
PdfEditorSignaturePlacement.invisiblePdfEditorStamp
class PdfEditorStampA rubber stamp for PdfEditorConfiguration.stamps. PdfEditorStamp.date reads the day it's placed.
PdfEditorStamp
const PdfEditorStamp(this.text, this.color) : isDate = falsePdfEditorStamp.date
const PdfEditorStamp.date(this.color) : text = '', isDate = truetext
final String textcolor
final Color colorisDate
final bool isDatePdfEditorMenuItem
enum PdfEditorMenuItemThe ⋮ (More) menu's items. flattenDocument exists on Android only and is ignored on iOS.
search
PdfEditorMenuItem.searchmanagePages
PdfEditorMenuItem.managePagessharePdf
PdfEditorMenuItem.sharePdfprint
PdfEditorMenuItem.printflattenAndShare
PdfEditorMenuItem.flattenAndShareflattenDocument
PdfEditorMenuItem.flattenDocumentresetForm
PdfEditorMenuItem.resetFormresetToOriginal
PdfEditorMenuItem.resetToOriginalPdfEditorColorScheme
enum PdfEditorColorSchemeThe editor's appearance.
system
PdfEditorColorScheme.systemlight
PdfEditorColorScheme.lightdark
PdfEditorColorScheme.darkPdfEditorLayoutDirection
enum PdfEditorLayoutDirectionThe editor's reading direction. automatic follows PdfEditorLocalization.language.
automatic
PdfEditorLayoutDirection.automaticltr
PdfEditorLayoutDirection.ltrrtl
PdfEditorLayoutDirection.rtlPdfEditorLocalization
class PdfEditorLocalizationThe editor's language: text for its words by key (the keys are the same on every platform; the list with the English text is docs/localization/strings.json). Untranslated keys stay English. Placeholders are positional, "Page {1} of {2}". toolTitles, modeTitles and menuItemTitles win over it.
PdfEditorLocalization
const PdfEditorLocalization(
{
this.language,
this.strings = const {},
this.layoutDirection = PdfEditorLayoutDirection.automatic,
}
)language
final String? languageA BCP-47 tag ("hi", "ar", "pt-BR"); null = the app's language. Also picks the native SDK's own resources in that language (<language>.lproj/PDFEditor.strings on iOS, values-<language> on Android).
strings
final Map<String, String> stringsKey → text.
layoutDirection
final PdfEditorLayoutDirection layoutDirectiontoMap
Map<String, Object?> toMap()PdfEditorHandleShape
enum PdfEditorHandleShapeThe shape of the selection handles.
roundedSquare
PdfEditorHandleShape.roundedSquarecircle
PdfEditorHandleShape.circlesquare
PdfEditorHandleShape.squarePdfEditorMarkupStyle
class PdfEditorMarkupStyleA text-markup tool's first-use style. opacity is clamped to 0.1–1.
PdfEditorMarkupStyle
const PdfEditorMarkupStyle({required this.color, this.opacity = 1})color
final Color coloropacity
final double opacityPdfEditorInkStyle
class PdfEditorInkStylewidth is clamped to 1–30 points, opacity to 0.1–1.
PdfEditorInkStyle
const PdfEditorInkStyle(
{
required this.color,
this.width = 5,
this.opacity = 1,
}
)color
final Color colorwidth
final double widthopacity
final double opacityPdfEditorColors
class PdfEditorColorsThe editor's own colours. Each one left null keeps the editor's. Give toolbarBackground and no toolbarForeground, and the editor picks white or near-black ink for it.
PdfEditorColors
const PdfEditorColors(
{
this.accent,
this.onAccent,
this.canvasBackground,
this.toolbarBackground,
this.toolbarForeground,
this.secondaryForeground,
this.panelBackground,
this.destructive,
}
)accent
final Color? accentButtons, the armed tool, Done, the selection (unless PdfEditorConfiguration.selectionColor is set).
onAccent
final Color? onAccentText and glyphs drawn on the accent.
canvasBackground
final Color? canvasBackgroundBehind and around the pages.
toolbarBackground
final Color? toolbarBackgroundThe header, the mode toolbar, the property bars and the floating pills.
toolbarForeground
final Color? toolbarForegroundIcons and labels on those bars.
secondaryForeground
final Color? secondaryForegroundCaptions, hints, inactive labels.
panelBackground
final Color? panelBackgroundThe editor's sheets, dialogs and (Android) menus.
destructive
final Color? destructiveDelete and other destructive actions.
PdfEditorToolDefaults
class PdfEditorToolDefaultsOnce a user picks their own colour, theirs wins on that device.
PdfEditorToolDefaults
const PdfEditorToolDefaults(
{
this.highlight,
this.underline,
this.strikeout,
this.squiggly,
this.ink,
}
)highlight
final PdfEditorMarkupStyle? highlightunderline
final PdfEditorMarkupStyle? underlinestrikeout
final PdfEditorMarkupStyle? strikeoutsquiggly
final PdfEditorMarkupStyle? squigglyink
final PdfEditorInkStyle? inkPdfEditorConfiguration
class PdfEditorConfigurationHow the editor looks and what it offers. Every field is optional; leave one out and the editor keeps its own behaviour. Every option only narrows or restyles — values outside what the editor supports are clamped by the native SDK.
The same options as the native PDFEditorConfiguration / PdfEditorConfiguration, minus the ones that can't cross a platform channel: custom icons and your own buttons (images and callbacks) stay native-only.
PdfEditorConfiguration
const PdfEditorConfiguration(
{
this.modes,
this.hiddenTools,
this.hiddenMenuItems,
this.colorScheme,
this.minZoom,
this.maxZoom,
this.haptics,
this.showsUsageHints,
this.localization,
this.toolTitles,
this.modeTitles,
this.menuItemTitles,
this.toolOrder,
this.menuOrder,
this.interfaceFontFamily,
this.fonts,
this.fontsTitle,
this.showsStandardFonts,
this.showsDocumentFonts,
this.showsDeviceFonts,
this.allowsFontImport,
this.newTextFont,
this.selectionColor,
this.selectionColorDark,
this.handleFillColor,
this.handleShape,
this.handleScale,
this.selectionBorderWidth,
this.searchHighlightColor,
this.searchCurrentHighlightColor,
this.toolDefaults,
this.colors,
this.colorsDark,
this.actionTitles,
this.hiddenActions,
this.actionOrder,
this.markupColors,
this.inkColors,
this.signatureColors,
this.stamps,
this.allowsCustomStamp,
this.fontSizes,
this.signatureMethods,
this.signaturePlacement,
this.showsUndoRedo,
this.showsPageNavigator,
this.showsZoomControls,
}
)modes
final List<PdfEditorMode>? modesThe modes the Tools sheet offers, in this order. One mode hides the mode picker.
hiddenTools
final Set<PdfEditorTool>? hiddenToolsTools removed from every mode that carries them.
hiddenMenuItems
final Set<PdfEditorMenuItem>? hiddenMenuItemsItems removed from the ⋮ menu.
colorScheme
final PdfEditorColorScheme? colorSchemeLight, dark, or the system's (the default).
minZoom
final double? minZoomThe zoom range, where 1 is the page fitted to the screen. Clamped to 0.5–3. 1 and 1 turn zoom off.
maxZoom
final double? maxZoomhaptics
final bool? hapticsTaps, snaps and alignment guides.
showsUsageHints
final bool? showsUsageHintsOne-time hints such as "Drag across text to highlight it".
localization
final PdfEditorLocalization? localizationThe editor's language — see PdfEditorLocalization.
toolTitles
final Map<PdfEditorTool, String>? toolTitlesYour names for tools (everywhere they appear), modes and ⋮ items.
modeTitles
final Map<PdfEditorMode, String>? modeTitlesmenuItemTitles
final Map<PdfEditorMenuItem, String>? menuItemTitlestoolOrder
final Map<PdfEditorMode, List<PdfEditorTool>>? toolOrderListed tools first, in your order, then the rest. A tool can only be reordered within a mode it is in.
menuOrder
final List<PdfEditorMenuItem>? menuOrderListed ⋮ items first, then the rest.
interfaceFontFamily
final String? interfaceFontFamilyiOS only: the editor's own text in this font family (one the app bundles or the system has).
fonts
final List<String>? fontsFont files (paths on disk) listed first in the text font picker, under fontsTitle.
fontsTitle
final String? fontsTitleshowsStandardFonts
final bool? showsStandardFontsWhich other sections the font picker shows: the standard PDF fonts (Helvetica, Times, Courier), the document's embedded fonts, the device's fonts, and the import button with the fonts imported before.
showsDocumentFonts
final bool? showsDocumentFontsshowsDeviceFonts
final bool? showsDeviceFontsallowsFontImport
final bool? allowsFontImportnewTextFont
final String? newTextFontA font file (path) that every new text box is set in. Size and colour still follow the surrounding text.
selectionColor
final Color? selectionColorThe selection box, handles, rotate knob, caret, text-selection band and page guide. Always opaque. selectionColorDark (Android) is used in the dark scheme; on iOS selectionColor is used in both.
selectionColorDark
final Color? selectionColorDarkhandleFillColor
final Color? handleFillColorhandleShape
final PdfEditorHandleShape? handleShapehandleScale
final double? handleScaleHandle and knob size, clamped to 0.75–1.5.
selectionBorderWidth
final double? selectionBorderWidthThe selection outline, in points, clamped to 1–3.
searchHighlightColor
final Color? searchHighlightColorThe wash over every search match, and over the current one. The translucency stays the editor's.
searchCurrentHighlightColor
final Color? searchCurrentHighlightColortoolDefaults
final PdfEditorToolDefaults? toolDefaultscolors
final PdfEditorColors? colorsThe editor's own colours: accent, canvas, toolbars, panels and their ink. colorsDark overrides colors field by field in the dark scheme.
colorsDark
final PdfEditorColors? colorsDarkactionTitles
final Map<PdfEditorAction, String>? actionTitlesYour names for the sub-tools — the property bar's Edit, Color, Font, Crop, Cut, Delete…, the menu over the selection, and the page panel's actions. A name applies wherever the action appears.
hiddenActions
final Set<PdfEditorAction>? hiddenActionsSub-tools removed wherever they appear.
actionOrder
final List<PdfEditorAction>? actionOrderListed sub-tools first, in this order, in every bar and menu that has them; the rest keep the editor's order.
markupColors
final List<Color>? markupColorsThe Annotate colour row, the Draw ink colours (Android, and iOS on Mac) and the signature pad's colours.
inkColors
final List<Color>? inkColorssignatureColors
final List<Color>? signatureColorsstamps
final List<PdfEditorStamp>? stampsThe Stamp tool's presets, and whether its Custom Photo button shows.
allowsCustomStamp
final bool? allowsCustomStampfontSizes
final List<int>? fontSizesThe font-size list, in points.
signatureMethods
final List<PdfEditorSignatureMethod>? signatureMethodsThe signature pad's tabs, in order.
signaturePlacement
final PdfEditorSignaturePlacement? signaturePlacementWhere the e-Sign tab's Placement picker starts (the user can still change it). Default bottom right.
showsUndoRedo
final bool? showsUndoRedoThe floating pills along the bottom.
showsPageNavigator
final bool? showsPageNavigatorshowsZoomControls
final bool? showsZoomControlstoMap
Map<String, Object?> toMap()The plain-value form both native SDKs read (PDFEditorConfiguration(options:) / PdfEditorConfiguration.fromOptions). Public so a test can check exactly what crosses the channel.
Document API
PdfRect
class PdfRectA rectangle in page points, top-left origin.
PdfRect
const PdfRect(this.x, this.y, this.width, this.height)x
final double x, y, width, heightPdfLayerKind
enum PdfLayerKindtext
PdfLayerKind.textimage
PdfLayerKind.imagenote
PdfLayerKind.notesignature
PdfLayerKind.signaturedrawing
PdfLayerKind.drawingsound
PdfLayerKind.soundshape
PdfLayerKind.shapevector
PdfLayerKind.vectorPdfShape
enum PdfShaperectangle
PdfShape.rectangleellipse
PdfShape.ellipseline
PdfShape.linearrow
PdfShape.arrowPdfLayer
class PdfLayerOne layer of a page, as data. Read again after a change — a layer's properties are a snapshot.
page
final int pageid
final int idStable while other layers change; a layer that comes back from undo gets a new one.
kind
final PdfLayerKind kindframe
final PdfRect framerotation
final double rotationDegrees, clockwise as seen.
opacity
final double opacityzIndex
final int zIndexlink
final String? linktext
final String? textfontName
final String? fontNamefontSize
final double? fontSizebold
final bool bold, italic, underline, strikethrough, fontEmbeddedsymbolic
final bool symbolicSet entirely in symbol fonts — an ornament or a check box drawn as letters. Not language.
textColor
final Color? textColor, highlightColorpixelWidth
final int? pixelWidth, pixelHeightnote
final String? notenoteColor
final Color? noteColor, noteTextColorshape
final PdfShape? shapefillColor
final Color? fillColor, strokeColorstrokeWidth
final double? strokeWidthPdfSearchMatch
class PdfSearchMatchPdfSearchMatch
const PdfSearchMatch(this.page, this.rects)page
final int pagerects
final List<PdfRect> rectsPdfFormField
class PdfFormFieldA form field of the document.
name
final String namekind
final String kindtext, checkbox, radio, combobox, listbox, button, signature or unknown.
page
final int pageframe
final PdfRect framevalue
final String valuechecked
final bool? checkedexportValue
final String? exportValueoptions
final List<String> optionsreadOnly
final bool readOnlyPdfMetadataKey
enum PdfMetadataKeytitle
PdfMetadataKey.titleauthor
PdfMetadataKey.authorsubject
PdfMetadataKey.subjectkeywords
PdfMetadataKey.keywordscreator
PdfMetadataKey.creatorproducer
PdfMetadataKey.producerPdfFontFamily
enum PdfFontFamilyThe built-in families every PDF reader has.
sans
PdfFontFamily.sansserif
PdfFontFamily.serifmono
PdfFontFamily.monoPdfZOrder
enum PdfZOrdertoBack
PdfZOrder.toBackbackward
PdfZOrder.backwardforward
PdfZOrder.forwardtoFront
PdfZOrder.toFrontPdfMarkupKind
enum PdfMarkupKindhighlight
PdfMarkupKind.highlightstrikeout
PdfMarkupKind.strikeoutsquiggly
PdfMarkupKind.squigglyPdfImageKind
enum PdfImageKindWhat an image layer is to the editor: a signature, a hand drawing and a stamp are images it knows by kind.
photo
PdfImageKind.photonote
PdfImageKind.notesignature
PdfImageKind.signaturedrawing
PdfImageKind.drawingPdfFormFieldKind
enum PdfFormFieldKindtext
PdfFormFieldKind.textcheckbox
PdfFormFieldKind.checkboxradio
PdfFormFieldKind.radiolistBox
PdfFormFieldKind.listBoxdropdown
PdfFormFieldKind.dropdownPdfTextResult
enum PdfTextResultHow a text replacement went: it fits where the old text was, or it is taller (it may run into what is below).
replaced
PdfTextResult.replacedoverflow
PdfTextResult.overflowPdfDocumentException
class PdfDocumentException implements ExceptionWhy a document call failed. code: cannotOpen, notFound (read the layers again), unsupportedGlyphs (no font can draw the text — nothing changed), failed (the engine refused), badArguments.
PdfDocumentException
const PdfDocumentException(this.code, this.message)code
final String codemessage
final String messagePdfDocument
class PdfDocumentA PDF opened from code, with no UI — a templating, form-filling or batch job. close it when done.
final doc = await PdfDocument.open(bytes);
for (final block in await doc.textBlocks(0)) {
await doc.setText(block, await translate(block.text!), shrinkToFit: true);
}
final edited = await doc.save();
await doc.close();open
static Future<PdfDocument> open(
Uint8List bytes,
{
String? password,
}
) asyncOpen bytes headless, with the system's fonts for every script.
close
Future<void> close() asyncFree the native document. Calls after this fail with notFound.
pageCount
Future<int> get pageCount asyncpageSize
Future<Size> pageSize(int page) asyncThe page's size in points (as displayed, i.e. after its rotation).
save
Future<Uint8List> save() asyncThe edited PDF.
metadata
Future<String> metadata(PdfMetadataKey key) asyncsetMetadata
Future<void> setMetadata(PdfMetadataKey key, String value)Written into the file save produces.
text
Future<String> text(int page) asyncThe page's plain text.
search
Future<List<PdfSearchMatch>> search(
String query,
{
bool caseSensitive = false,
}
) asyncEvery match of query in the document.
renderPage
Future<Uint8List?> renderPage(int page, int width, int height)The page drawn into a width×height PNG (a thumbnail, a preview).
canUndo
Future<bool> get canUndo asynccanRedo
Future<bool> get canRedo asyncundo
Future<bool> undo() asyncUndo the last change. A layer that comes back gets a NEW id — read the layers again.
redo
Future<bool> redo() asyncinsertBlankPage
Future<void> insertBlankPage(
int index,
{
double width = 0,
double height = 0,
}
)Insert a blank page at index (a zero size takes the neighbouring page's).
deletePage
Future<void> deletePage(int index)movePage
Future<void> movePage(int from, int to)duplicatePage
Future<void> duplicatePage(int index)rotatePage
Future<void> rotatePage(int index, {bool clockwise = true})importPages
Future<void> importPages(
Uint8List bytes,
{
String? password,
List<int>? pages,
int? index,
}
)Copy pages (all when null) of another PDF in at index (null = the end). Layer ids must be read again.
extractPages
Future<Uint8List> extractPages(List<int> pages) asyncpages of this document as a new PDF.
layers
Future<List<PdfLayer>> layers(int page)Every layer of the page, in reading order for a page read the first time.
textBlocks
Future<List<PdfLayer>> textBlocks(int page)layer
Future<PdfLayer> layer(PdfLayer layer)The layer as it is now.
image
Future<Uint8List?> image(PdfLayer layer)The picture of an image layer as PNG, at its own pixel size.
sound
Future<Uint8List?> sound(PdfLayer layer)The audio of a sound layer.
setText
Future<PdfTextResult> setText(
PdfLayer layer,
String text,
{
bool shrinkToFit = false,
}
) asyncReplace a text layer's text, keeping its font, size, colour and position. Any script works: the system's fonts fill in what the layer's font lacks. shrinkToFit lowers the size (to half at most) until it fits.
setFontSize
Future<void> setFontSize(PdfLayer layer, double points)setFont
Future<void> setFont(
PdfLayer layer,
PdfFontFamily family,
{
bool bold = false,
bool italic = false,
}
)setFontData
Future<void> setFontData(PdfLayer layer, Uint8List data, String name)Embed a font of your own (TTF/OTF bytes) and set the layer in it.
setTextStyle
Future<void> setTextStyle(PdfLayer layer, {bool? bold, bool? italic})Bold / italic of the current family; null leaves that one as it is.
setUnderline
Future<void> setUnderline(PdfLayer layer, bool on)setStrikethrough
Future<void> setStrikethrough(PdfLayer layer, bool on)setFillColor
Future<void> setFillColor(PdfLayer layer, Color color)Text colour, or a shape's fill.
setStrokeColor
Future<void> setStrokeColor(PdfLayer layer, Color color)setStrokeWidth
Future<void> setStrokeWidth(PdfLayer layer, double points)setOpacity
Future<void> setOpacity(PdfLayer layer, double opacity)setFrame
Future<void> setFrame(PdfLayer layer, PdfRect frame)Move and resize (text scales uniformly).
setRotation
Future<void> setRotation(PdfLayer layer, double degrees)Degrees, clockwise as seen.
setZOrder
Future<void> setZOrder(PdfLayer layer, PdfZOrder order)setLink
Future<void> setLink(PdfLayer layer, String? url)null removes the link.
setSound
Future<void> setSound(PdfLayer layer, Uint8List audio, String name)replaceImage
Future<void> replaceImage(PdfLayer layer, Uint8List image)Swap an image layer's picture (PNG or JPEG bytes), keeping its frame and kind.
setMarkup
Future<void> setMarkup(PdfLayer layer, PdfMarkupKind kind, Color color)Mark a whole text layer up.
removeMarkup
Future<void> removeMarkup(PdfLayer layer)delete
Future<void> delete(PdfLayer layer)duplicate
Future<PdfLayer> duplicate(
PdfLayer layer,
{
double dx = 12,
double dy = 12,
}
)A copy offset by (dx, dy) points.
copy
Future<PdfLayer> copy(PdfLayer layer, int toPage, double x, double y)A copy on another page, its top-left at (x, y) there.
addText
Future<PdfLayer> addText(
String text,
int page,
double x,
double y,
{
double fontSize = 14,
Color color = const Color(0xFF000000),
PdfFontFamily family = PdfFontFamily.sans,
}
)A text layer with its top-left at (x, y).
addImage
Future<PdfLayer> addImage(
Uint8List image,
int page,
PdfRect frame,
{
PdfImageKind kind = PdfImageKind.photo,
String? note,
}
)An image layer (PNG or JPEG bytes) filling frame. A signature, a drawing or a stamp is an image of that kind.
addShape
Future<PdfLayer> addShape(
PdfShape shape,
int page,
Offset from,
Offset to,
{
Color fill = const Color(0x00000000),
Color stroke = const Color(0xFF000000),
double strokeWidth = 2,
}
)A rectangle or ellipse filling the rect from start to end, or a line / arrow from start to end.
markupText
Future<void> markupText(
int page,
Offset from,
Offset to,
{
PdfMarkupKind kind = PdfMarkupKind.highlight,
Color color = const Color(0xFFFFE44D),
}
)Mark up the text between two points of the page, as a drag with the tool would.
formFields
Future<List<PdfFormField>> formFields() asyncsetFormValue
Future<void> setFormValue(String field, String value)Fill a field: its text, an option's label, "true"/"false" for a check box, or the radio button's export value.
fillForm
Future<void> fillForm(Map<String, String> values)Fill several fields at once.
addFormField
Future<String> addFormField(
PdfFormFieldKind kind,
int page,
PdfRect frame,
{
String? name,
List<String> options = const <String>[],
}
) asyncA new field; returns its name (name, or one the editor made up). Radios that share a name are one set.
deleteFormField
Future<void> deleteFormField(String name)Remove every widget called name (a whole radio set).
resetForm
Future<void> resetForm()flattenForm
Future<void> flattenForm()Bake the fields into the pages (their values stay, they stop being editable).
SDK, licensing and callbacks
PdfEditorLicense
class PdfEditorLicenseThe license verdict, as the native SDK decided it.
status
final String statusvalid, unlicensed, invalid, expired, wrongApp, wrongPlatform, versionNotCovered, … and for an online key suspended (the vendor suspended it) or verificationRequired (not confirmed with the license server yet — the native SDK confirms it on its own).
isLicensed
final bool isLicensedreason
final String reasonA sentence saying why — show it to yourself, in a debug build, when isLicensed is false.
licensee
final String licenseeplan
final String planexpires
final String? expiresidentity
final String identityThe bundle identifier / package name the key was checked against.
licenseId
final String licenseIdThe license id (lic_…) — quote it when you renew.
updatesUntil
final String? updatesUntil"Updates until": the key covers SDK releases published on or before this date (versionNotCovered when this release is newer). Null when the key has no such limit.
isOnline
final bool isOnlineAn online key: confirmed with the vendor's license server, which can suspend and resume it.
paymentDue
final bool paymentDueOnline keys: the vendor marked the payment overdue. It still works.
message
final String messageOnline keys: the vendor's note to the developer.
Flutter
The pdf_editor plugin opens the native PDF-SDK editor full screen and hands back the edited file. It's a thin binding over the iOS and Android SDKs, so your Flutter app gets exactly the same editor, on both platforms.
React Native
@pdfsdk/react-native-pdf-editor opens the native PDF-SDK editor full screen and resolves with the edited file. It's a thin binding over the iOS and Android SDKs, with the same API and option names as the Flutter plugin.