Configuring PSPDFKitView properties

The configuration property of a PSPDFKitView is of type PDFConfiguration and defines its behavior. Here’s an example showing how you can set your PSPDFKitView’s configuration:

<PSPDFKitView
document={DOCUMENT}
configuration={{
pageTransition: 'scrollPerSpread',
scrollDirection: 'vertical',
pageMode: 'single',
showPageLabels: true,
showThumbnailBar: 'scrollable',
// Only stamps and square annotations will be editable; other annotations can't be selected or otherwise modified.
editableAnnotationTypes: ['Stamp', 'Square'],
}}
ref="pdfView"
fragmentTag="PDF1"
style={{ flex: 1 }}
pageIndex={3}
/>

You can find API documentation of the available configuration options here.

Retrieving the current configuration

The current configuration can be retrieved using the getConfiguration API available on the PSPDFKitView instance. The PDFConfiguration object can then be inspected or persisted and reapplied to a new PSPDFKitView instance to preserve the configuration:

const configuration = await this.pdfRef?.current?.getConfiguration();

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: android or iOS. The options, grouped roughly by category, are shown below.

Document interaction options

Configuration OptionData TypePossible ValuesiOSAndroidDocumentation
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.
documentPasswordString
The password to unlock the document.
enableTextSelectionBooleantrue / falseAllow / disallow text selection.
autosaveEnabledBooleantrue / falseDetermines whether PSPDFKit should save automatically in response to certain UI triggers, such as the app entering the background or the view disappearing.
disableAutomaticSavingBooleantrue / falseDetermines whether PSPDFKit should save automatically in response to certain UI triggers, such as the app entering the background or the view disappearing.
signatureSavingStrategyStringalwaysSave, neverSave, saveIfSelectedDetermines whether signatures should be saved after creation.
iOSShouldScrollToChangedPageBooleantrue / falseScrolls to the affected page during an undo / redo operation.
iOSScrollViewInsetAdjustmentStringnone, fixedElements, allElementsSets the scroll view inset adjustment mode.
iOSFormElementZoomEnabledBooleantrue / falseOption to automatically focus on selected form elements.
iOSImageSelectionEnabledBooleantrue / falseAllow / disallow image selection.
iOSTextSelectionShouldSnapToWordBooleantrue / falseConfigure if text selection should snap to words.
iOSFreeTextAccessoryViewEnabledBooleantrue / falseShows a toolbar with text editing options above the keyboard while editing free text annotations.
iOSInternalTapGesturesEnabledBooleantrue / falseEnable / disable all internal gesture recognizers.
iOSAllowBackgroundSavingBooleantrue / falseDetermines whether automatic saving should happen on a background thread.
iOSMinimumZoomScalefloat
Minimum zoom scale for the scroll view.
iOSMaximumZoomScalefloat
Maximum zoom scale for the scroll view.
iOSDoubleTapActionStringnone, zoom, smartZoomThe action that happens when the user double taps somewhere in the document.
iOSTextSelectionModeStringregular, simple, automaticDefines how the text is selected.
iOSTypesShowingColorPresetsSetnone, undefined, all, Link, Highlight, Underline, Squiggly, StrikeOut, Text, Caret, FreeText, Ink, Square, Circle, Line, Signature, Stamp, Eraser, Image, Widget, FileAttachment, Sound, Polygon, PolyLine, RichMedia, Screen, Popup, Watermark, TrapNet, 3D, RedactShows a custom cell with configurable color presets for the provided annotation types.

Document presentation options

Configuration OptionData TypePossible ValuesiOSAndroidDocumentation
pageModeStringsingle, double, automaticConfigure the page mode.
firstPageAlwaysSingleBooleantrue / falseOption to show the first page separately.
showPageLabelsBooleantrue / falseDisplays the current page number.
documentLabelEnabledBooleantrue / falseShows an overlay displaying the document name.
spreadFittingBooleantrue / falseControls the page fitting mode. adaptive mode only works on iOS and has no effect on Android.
invertColorsBooleantrue / falseInverts the document color if true.
androidGrayScaleBooleantrue / falseConverts the document colors to grayscale.
iOSClipToPageBoundariesBooleantrue / falseOption to clip content to page boundaries.
iOSBackgroundColorUIColor
Background color behind the page view.
iOSRenderAnimationEnabledBooleantrue / falseShows a UIActivityIndicatorView in the top-right corner while the page is rendering.
iOSRenderStatusViewPositionStringtop, centeredPosition of the render status view.
iOSAllowedAppearanceModesStringdefault, sepia, night, allAllowed appearance modes for BrightnessViewController.

User interface options

Configuration OptionData TypePossible ValuesiOSAndroidDocumentation
userInterfaceViewModeStringautomatic, automaticBorderPages, automaticNoFirstLastPage, always, alwaysVisible, alwaysHidden, neverConfigures the user interface visibility.
inlineSearchBooleantrue / falseSets the type of search bar to be inline or modular.
immersiveModeBooleantrue / falseHides the user interface if set to true.
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.
iOSShouldHideUserInterfaceOnPageChangeBooleantrue / falseOption to hide / show the user interface when changing pages.
iOSShouldShowUserInterfaceOnViewWillAppearBooleantrue / falseOption to hide / show the user interface when the page appears.
iOSShouldHideStatusBarWithUserInterfaceBooleantrue / falseOption to hide / show the status bar with the user interface.
iOSShouldHideNavigationBarWithUserInterfaceBooleantrue / falseOption to hide / show the navigation bar with the user interface.
iOSSearchModeStringmodal, inlineSets the type of search bar to be inline or modal.
iOSScrollOnEdgeTapEnabledBooleantrue / falseDetermines whether tapping on leading / trailing edges of the document view should trigger changing to the previous / next page.
iOSScrollOnEdgeTapMarginfloat
The margin in points from the view’s sides in which tapping should trigger scrolling to the previous / next page.
iOSUseParentNavigationBarBooleantrue / falseSet this to true to allow this controller to access the parent navigationBar / navigationController to add custom buttons.
iOSAllowToolbarTitleChangeBooleantrue / falseAllow PSPDFKit to change the title of this view controller.
iOSShouldHideStatusBarBooleantrue / falseIf true, the status bar will always remain hidden (regardless of the shouldHideStatusBarWithUserInterface setting).
iOSShowBackActionButtonBooleantrue / falseShows a floating back button in the lower part of the screen.
iOSShowForwardActionButtonBooleantrue / falseShows a floating forward button in the lower part of the screen.
iOSShowBackForwardActionButtonLabelsBooleantrue/ falseAdds text labels representing the destination name to the back and forward buttons.
iOSSearchResultZoomScalefloat
Increase this to zoom to the search result.
iOSAdditionalScrollViewFrameInsetsUIEdgeInsets
Additional insets to apply to the document scroll view’s frame.
iOSAdditionalContentInsetsUIEdgeInsets
Additional insets to apply to the layout’s content.
iOSAllowedMenuActionsStringnone, search, define, wikipedia, speak, allMay be used to customize other displayed menu actions when text is selected.
iOSSettingsOptionsSetscrollDirection, pageTransition, appearance, brightness, pageMode, spreadFitting, default, allOptions that will be presented by PDFSettingsViewController. Defaults to .default.
iOSShadowEnabledBooleantrue / falseEnable / disable page shadow.
iOSShadowOpacityfloat
Set the default shadowOpacity.

Thumbnail options

Configuration OptionData TypePossible ValuesiOSAndroidDocumentation
showThumbnailBarStringnone, default, floating, pinned, scrubberBar, scrollableThumbnail bar mode controls the display of page thumbnails viewing a document.
iOSScrubberBarTypeStringhorizontal, verticalLeft, verticalRightControls the placement of the scrubber bar.
iOSThumbnailGroupingStringautomatic, never, alwaysOption to set the grouping of thumbnails.

Annotation, forms, and bookmark options

Configuration OptionData TypePossible ValuesiOSAndroidDocumentation
editableAnnotationTypesSetnone, undefined, all, Link, Highlight, Underline, Squiggly, StrikeOut, Text, Caret, FreeText, Ink, Square, Circle, Line, Signature, Stamp, Eraser, Image, Widget, FileAttachment, Sound, Polygon, PolyLine, RichMedia, Screen, Popup, Watermark, TrapNet, 3D, RedactSet containing the annotation types that should be editable.
enableAnnotationEditingBooleantrue / falseConfiguration to enable / disable editing all annotations. To selectively enable editing for specific types of annotations, use editableAnnotationTypes.
enableFormEditingBooleantrue / falseConfiguration to enable / disable editing forms. This can also be accomplished by adding / removing the Widget annotation type from editableAnnotationTypes.
androidShowAnnotationListActionBooleantrue / falseEnables the list of annotations.
iOSShouldAskForAnnotationUsernameBooleantrue / falseIf true, asks the user to specify a custom annotation user name ("author") when creating a new annotation.
iOSLinkActionStringnone, alertView, openSafari, inlineBrowser, InlineWebViewControllerSets the default link action for pressing on LinkAnnotations.
iOSDrawCreateModeStringseparate, mergeIfPossibleDetermines whether new annotations are created when strokes end.
iOSAnnotationGroupingEnabledBooleantrue / falseIf set to true, you can group / ungroup annotations with the multi-select tool.
iOSNaturalDrawingAnnotationEnabledBooleantrue / falseEnables natural drawing for ink annotations.
iOSNaturalSignatureDrawingEnabledBooleantrue / falseEnables natural drawing for signatures.
iOSAnnotationEntersEditModeAfterSecondTapEnabledBooleantrue / falseControls if a second tap to an annotation that allows inline editing enters edit mode.
iOSCreateAnnotationMenuEnabledBooleantrue / falseIf set to true, a long tap that ends on a page area that isn’t a text / image will show a new menu to create annotations.
iOSAnnotationAnimationDurationfloat
Overlay annotations are faded in. Set the global duration for this fade here.
iOSSoundAnnotationTimeLimitfloat
Describes the time limit for recording sound annotations, in seconds.
iOSBookmarkSortOrderStringcustom, pageBasedControls how bookmarks are displayed and managed.