Configuring PDF view properties

The configuration property for PspdfkitWidget enables you to customize various properties of the PDF view. Here’s an example showcasing how you can set your PDF view’s configuration:

PspdfkitWidget(
documentPath: document.path,
configuration: PdfConfiguration(
toolbarTitle: 'PSPDFKit Flutter Example',
scrollDirection: PspdfkitScrollDirection.horizontal,
pageLayoutMode: PspdfkitPageLayoutMode.single,
pageTransition: PspdfkitPageTransition.scrollContinuous,
spreadFitting: PspdfkitSpreadFitting.fit,
immersiveMode: false,
showPageLabels: true,
showActionNavigationButtons: true,
userInterfaceViewMode:
PspdfkitUserInterfaceViewMode.automatic,
androidShowSearchAction: true,
inlineSearch: false,
showThumbnailBar: PspdfkitThumbnailBarMode.floating,
androidShowThumbnailGridAction: true,
androidShowOutlineAction: true,
androidShowAnnotationListAction: true,
documentLabelEnabled: false,
invertColors: false,
androidGrayScale: false,
startPage: 2,
enableAnnotationEditing: true,
enableTextSelection: false,
androidShowBookmarksAction: false,
androidEnableDocumentEditor: false,
androidShowShareAction: true,
androidShowPrintAction: false,
androidShowDocumentInfoView: true,
appearanceMode: PspdfkitAppearanceMode.defaultMode,
androidDefaultThemeResource: 'PSPDFKit.Theme.Example',
iOSRightBarButtonItems: [
'thumbnailsButtonItem',
'activityButtonItem',
'searchButtonItem',
'annotationButtonItem'
],
iOSLeftBarButtonItems: ['settingsButtonItem'],
iOSAllowToolbarTitleChange: false,
firstPageAlwaysSingle: true,
enableInstantComments: true,
webConfiguration: PdfWebConfiguration(
allowPrinting: false,
disableForms: false,
showAnnotationNotes: true,
showSignatureValidationStatus:
ShowSignatureValidationStatusMode.ifSigned,
sideBarMode: PspdfkitSidebarMode.annotations,
spreadSpacing: 20,
enableClipboardActions: true,
autoSaveMode: PspdfkitAutoSaveMode.disabled,
)),
);

Configuration options

Here’s the complete list of configuration options supported by each platform. Note that some options are only supported on a single platform — that’s because of differences in the behavior of both of these platforms. Options that work on only one platform are prefixed with the appropriate platform name for Android and iOS. Meanwhile, for Web, they're grouped into the webConfiguration property. The options, grouped by category, are shown below.

Document interaction options

Configuration OptionData TypePossible ValuesiOSAndroidWebDescription
scrollDirectionStringhorizontal, verticalConfigures the direction of page scrolling in the document view.
pageTransitionStringscrollPerSpread, scrollContinuous, curlConfigures the page scrolling mode. Note that curl mode is only available for iOS and will be ignored on Android.
enableTextSelectionBooleantrue / falseAllow / disallow text selection.

Document presentation options

Configuration OptionData TypePossible ValuesiOSAndroidWebDescription
pageModeStringsingle, double, automaticConfigure the page mode.
spreadFittingStringfit, fill, adaptiveControls the page fitting mode. adaptive mode only works on iOS and has no effect on Android.
showPageLabelsBooleantrue / falseDisplays the current page number.
startPageInteger
Configures the starting page number.
documentLabelEnabledBooltrue / falseShows an overlay displaying the document name.
firstPageAlwaysSingleBooleantrue / falseOption to show the first page separately.
invertColorsBooleantrue / falseInverts the document color if true.
passwordString
The password needed to unlock the document.
androidGrayScaleBooleantrue / falseConverts the document colors to grayscale.

User interface options

Configuration OptionData TypePossible ValuesiOSAndroidWebDescription
inlineSearchBooleantrue / falseSets the type of search bar to be inline or modular.
toolbarTitleString
Sets the title of the toolbar. Note: For iOS, you need to set documentLabelEnabled, iOSUseParentNavigationBar, and iOSAllowToolbarTitleChange to false in your configuration before setting the custom title.
showActionNavigationButtonsBooleantrue / falseShow action navigation buttons.
userInterfaceViewModeStringautomatic, automaticBorderPages, automaticNoFirstLastPage, always, alwaysVisible, alwaysHidden, neverConfigures the user interface visibility.
immersiveModeBooleantrue / falseHides the user interface if set to true.
appearanceModeStringdefault, night, sepiaSets the appearance mode for the document.
settingsMenuItems[Array of String]pageTransition, scrollDirection, androidTheme, iOSAppearance, androidPageLayout, iOSPageMode, iOSSpreadFitting, androidScreenAwake, iOSBrightnessOptions that will be presented in the settings menu. The options prefixed with iOS or Android only work on the respective platform. Options without any prefix work on both platforms.
androidShowSearchActionBooleantrue / falseEnables / disables document search functionality. For iOS, add searchButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidShowOutlineActionBooleantrue / falseEnables / disables outline menu in the activity. For iOS, add outlineButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidShowBookmarksActionBooleantrue / falseEnables / disables the bookmark list. For iOS, add bookmarkButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidShowShareActionBooleantrue / falseEnables the display of share features. For iOS, add activityButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidShowPrintActionBooleantrue / falseEnables the printing option in the menu, if applicable, for the document and the device. For iOS, add printButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidShowDocumentInfoViewBooleantrue / falseEnables the display of document information. For iOS, add outlineButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidEnableDocumentEditorBooleantrue / falseEnables / disables the document editor button. For iOS, add documentEditorButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.
androidDarkThemeResourceString
The resource string for the dark theme.
androidDefaultThemeResourceString
The resource string for the default theme.
iOSLeftBarButtonItems[Array of String]closeButtonItem, outlineButtonItem, searchButtonItem, thumbnailsButtonItem, documentEditorButtonItem, printButtonItem, openInButtonItem, emailButtonItem, messageButtonItem, annotationButtonItem, bookmarkButtonItem, brightnessButtonItem, activityButtonItem, settingsButtonItem, readerViewButtonItemSet the left bar button items. For Android, set individual options such as androidShowOutlineAction, androidShowSearchAction, etc. to achieve the same functionality.
iOSRightBarButtonItems[Array of String]closeButtonItem, outlineButtonItem, searchButtonItem, thumbnailsButtonItem, documentEditorButtonItem, printButtonItem, openInButtonItem, emailButtonItem, messageButtonItem, annotationButtonItem, bookmarkButtonItem, brightnessButtonItem, activityButtonItem, settingsButtonItem, readerViewButtonItemSet the right bar button items. For Android, set individual options such as androidShowOutlineAction, androidShowSearchAction, etc. to achieve the same functionality.
iOSAllowToolbarTitleChangeBooleantrue / falseAllow PSPDFKit to change the title of this view controller.

Thumbnail options

Configuration OptionData TypePossible ValuesiOSAndroidWebDescription
showThumbnailBarStringnone, default, floating, pinned, scrubberBar, scrollableThumbnail bar mode controls the display of page thumbnails viewing a document.
androidShowThumbnailGridActionBooleantrue / falseDisplays an action bar icon to show a grid of thumbnail pages. For iOS, add thumbnailsButtonItem to iOSLeftBarButtonItems or iOSRightBarButtonItems to achieve the same functionality.

Annotation, form, and bookmark options

Configuration OptionData TypePossible ValuesiOSAndroidWebDescription
enableAnnotationEditingBooleantrue / falseConfiguration to enable / disable editing all annotations.
androidShowAnnotationListActionBooleantrue / falseEnables the list of annotations. For iOS, add outlineButtonItem to iOSLeftBarButtonItems, or iOSRightBarButtonItems to achieve the same functionality.

Web-only options

The Web-specific options are grouped into webConfiguration, which takes a PdfWebConfiguration object. The options are shown below.

Configuration OptionData TypePossible ValuesiOSAndroidWebDescription
PspdfkitAutoSaveModeBooleandisabled, immediate, intelligentThe auto-save mode to use.
allowPrintingBooleantrue / falseWhether to allow printing.
disableFormsBooleantrue / falseWhether to disable forms.
showAnnotationNotesBooleantrue / falseWhether to show annotation notes.
showSignatureValidationStatusStringalways, ifSigned, neverThe mode for showing signature validation status.
sideBarModeStringannotations, bookmarks, thumbnails, documentInfo, outline
spreadSpacingNumber
The spacing between spreads.
enableClipboardActionsBooleantrue / falseWhether to enable clipboard actions.
interactionModeStringautomatic, selectionOnly, inkOnlyThe interaction mode to use.
sidebarModeStringannotations, bookmarks, thumbnails, documentInfo, outlineThe sidebar mode to use.
canScrollWhileDrawingBooleantrue / falseWhether to allow scrolling while drawing.
keepFirstSpreadAsSinglePageBooleantrue / false
keepSelectedToolBooleantrue / false
pageSpacingNumber
The spacing between pages.
pageRotationNumber
The rotation of the page.
previewRedactionModeBooleantrue / falseWhether to preview redaction mode.
showAnnotationNotesBooleantrue / falseWhether to show annotation notes.
customFontsArray
An array of custom fonts to load.
customRenderersObject
Custom renderers to use.
customUIConfigurationObject
Custom UI configuration to use.
electronicSignaturesObject
Electronic signatures configuration to use.
formDesignModeBooleantrue / falseWhether to enable form design mode.
maxMentionSuggestionsNumber
The maximum number of mention suggestions to show.
mentionableUsersArray
An array of mentionable users.
restrictAnnotationToPageBoundsBooleantrue / falseRestrict annotations to page bounds.
stampAnnotationTemplatesArray
An array of stamp annotation templates.
styleSheetsArray
An array of style sheets to load.
themeStringlight, darkThe web theme to use.
toolbarPlacementStringtop, bottomThe toolbar placement to use.
zoomNumber
The zoom level to use.
minDefaultZoomLevelNumber
The minimum default zoom level.
maxDefaultZoomLevelNumber
The maximum default zoom level.
zoomStepNumber
The zoom step to use.
toolbarItemsArray
An array of items to show in the toolbar.
xfdfString
The XFDF string to load into the document.
xfdfKeepCurrentAnnotationsbooltrue / falseWhether to keep the current annotations when loading XFDF.
autoCloseThresholdNumber
The threshold for automatically closing the document.
baseCoreUrlString
The base URL for the PSPDFKit Core library.
baseUrlString
The base URL for Document Engine.
containerString
The ID of the container element for the viewer.
disableHighQualityPrintingbooltrue / falseWhether to disable high-quality printing.
disableMultiSelectionbooltrue / falseWhether to disable multi-selection.
disableOpenParametersbooltrue / falseWhether to disable open parameters.
disableTextSelectionbooltrue / falseWhether to disable text selection.
disableWebAssemblyStreamingbooltrue / falseWhether to disable WebAssembly streaming.
documentEditorFooterItemsArray
An array of items to show in the document editor footer.
documentEditorToolbarItemsArray
An array of items to show in the document editor toolbar.
documentIdString
The ID of the document to load.
editableAnnotationTypesArray
An array of editable annotation types.
enableAutomaticLinkExtractionbooltrue / falseWhether to enable automatic link extraction.
enableHistorybooltrue / falseWhether to enable history.
enableServiceWorkerSupportbooltrue / falseWhether to enable service worker support.
formFieldsNotSavingSignaturesArray
An array of form fields that should not save signatures.
headlessbooltrue / falseWhether to run in headless mode.
instantbooltrue / falseWhether to run in Instant mode (Server only).
instantJSONObject
The JSON configuration for Instant mode (Server only).
localeString
The locale to use.
maxPasswordRetriesNumber
The maximum number of password retries.
overrideMemoryLimitNumber
The memory limit to override.
preventTextCopybooltrue / falseWhether to prevent text copy.
printOptionsObject
The print options to use.
serverUrlString
The URL of Document Engine (Server only).
standaloneInstancesPoolSizeNumber
The size of the Standalone instances pool.
viewportPaddingNumber
The viewport padding to use.
annotationToolbarItemsArray
An array of items to show in the annotation toolbar.