Customizing PDF viewer styling on Android

To customize UI elements, Nutrient uses the standard Android style and theme system(opens in a new tab). When declaring a theme for your application, you can define the primary colors using the attributes colorPrimary, colorAccent, and colorPrimaryDark. All UI components of Nutrient (toolbars, views, dialogs, etc.) will use these colors to style the rest of the UI.

Out of the box, Nutrient comes with two predefined themes — PSPDFKit.Theme.Default and PSPDFKit.Theme.Dark — for the PdfActivity and all of its views. This guide describes how to tweak the default appearance to match the look of your app.

Defining a custom theme

Since Nutrient adheres to Android’s style and theme framework, you have full control over styling the appearance of all Nutrient components. The PdfActivity is built on top of the Android Compatibility Library v7, which means your theme has to inherit from Theme.AppCompat.

Furthermore, since PdfActivity uses a custom toolbar system, the decor action bar of the activity has to be deactivated. The easiest way to do this is to use the default Nutrient themes (PSPDFKit.Theme.Default and PSPDFKit.Theme.Dark) or Theme.AppCompat.NoActionBar as a parent theme.

  1. Inside your app’s styles.xml, create a custom theme with Theme.AppCompat.NoActionBar as the parent. Or, to tweak the default style, a custom theme can inherit directly from PSPDFKit.Theme.Default or PSPDFKit.Theme.Dark as a parent:

    <style name="MyApp.PSPDFKitTheme" parent="PSPDFKit.Theme.Default">
    <item name="colorPrimary">@color/mymain_color</item>
    <item name="colorPrimaryDark">@color/mymain_color_dark</item>
    <item name="colorAccent">@color/mymain_color_accent</item>
    <!-- PSPDFKit comes with several styleable components. -->
    <item name="pspdf__inlineSearchStyle">@style/MyInlineSearch</item>
    </style>
    <style name="MyInlineSearch">
    <item name="pspdf__textColor">@color/my_inline_search_color</item>
    </style>

If you want to use a different parent theme, you can manually disable the default window decor action bar by setting windowActionBar to false and windowNoTitle to true.

  1. Next, set your theme to the PdfActivity using the android:theme property inside your AndroidManifest.xml:

    <application>
    <activity android:name="com.pspdfkit.ui.PdfActivity"
    android:theme="@style/MyApp.PSPDFKitTheme"/>
    </application>

A custom theme can be set either using the manifest or via PdfActivityConfiguration#Builder. In default mode, it can be set via PdfActivityConfiguration.Builder#theme(int), while in night theme mode, it can be set via PdfActivityConfiguration.Builder#themeDark(int). When a custom theme is set using the builder configuration, it overwrites the custom theme set in the manifest.

Nutrient resolves the used style values in the following order, using the first style found:

  1. Styles provided by the custom theme (i.e. your MyApp.PSPDFKitTheme in the above example) set in the manifest for com.pspdfkit.ui.PdfActivity.
  2. Default styles/internal Nutrient styles.

This means that Nutrient will use default values for all styles not covered under the current theme’s customization.

Available styles

Nutrient provides a large set of style attributes for both default and dark themes. This allows you to alter the appearance according to your needs. For a comprehensive usage example, have a look at DarkThemeExample and DarkThemeActivity inside the Catalog app.

If you want to tweak the default appearance of the chevron icon color inside the navigation history buttons, you can use the pspdf__navigationHistoryIconColor attribute:

<style name="MyApp.Theme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="pspdf__navigationHistoryIconColor">@color/dark_icons_blue</item>
</style>

Toolbar styling

You can easily tweak the main toolbar style using the pspdf__mainToolbarStyle attribute of your theme:

<style name="MyApp.Theme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="pspdf__mainToolbarStyle">@style/MyApp.MainToolbarStyle</item>
</style>
<style name="MyApp.MainToolbarStyle">
<item name="pspdf__backgroundColor">?colorPrimary</item>
<item name="pspdf__textColor">@color/dark_icons_blue</item>
<item name="pspdf__toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="pspdf__toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>

The following attributes can be modified for pspdf__mainToolbarStyle.

AttributeDescription
pspdf__backgroundColorBackground color of the main toolbar. This defaults to ?colorPrimary.
pspdf__textColorText color of the main toolbar. This defaults to white.
pspdf__toolbarThemeToolbar theme (set via android:theme on the Toolbar widget).
pspdf__toolbarPopupThemeToolbar popup theme (set via app:popupTheme on the Toolbar widget).

If you want to fully tweak the default appearance of the main toolbar, use the pspdf__toolbarTheme attribute to override the default theme used by the toolbar. Additionally, you can apply different themes used by toolbar popups with the pspdf__toolbarPopupTheme attribute of your theme.

If you want to tweak the default appearance of the icons inside the PdfActivity’s action bar, you can apply an icon style using the pspdf__actionBarIconsStyle attribute of your theme:

<style name="MyApp.Theme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="pspdf__actionBarIconsStyle">@style/MyApp.ActionBarIconsStyle</item>
</style>
<style name="MyApp.ActionBarIconsStyle">
<item name="pspdf__iconsColor">@color/dark_icons_blue</item>
<item name="pspdf__iconsColorActivated">@color/color_dark</item>
</style>

The following attributes can be modified for pspdf__actionBarIconsStyle.

AttributeDescription
pspdf__iconsColorColor of the icons.
pspdf__outlineIconIcon for the outline menu option.
pspdf__searchIconIcon for the search menu option.
pspdf__gridIconIcon for the thumbnail grid menu option.
pspdf__editAnnotationsIconIcon for the editing annotations menu option.
pspdf__settingsIconIcon for the settings menu option.
pspdf__shareIconIcon for the share menu option.
pspdf__iconsColorActivatedColor of the icons when activated.
pspdf__outlineIconActivatedIcon for the outline menu option when activated.
pspdf__searchIconActivatedIcon for the search menu option when activated.
pspdf__gridIconActivatedIcon for the thumbnail grid menu option when activated.
pspdf__editAnnotationsIconActivatedIcon for the editing annotations menu option when activated.
pspdf__settingsIconActivatedIcon for the settings menu option when activated.

Styling contextual toolbars

PSPDFKit uses custom contextual toolbars to present annotation editing, annotation creation, text selection, and document editing toolbars. To style contextual toolbars, use the pspdf__contextualToolbarStyle attribute of your theme:

<style name="MyApp.Theme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="pspdf__contextualToolbarStyle">@style/MyApp.ContextualToolbarStyle</item>
</style>
<style name="MyApp.ContextualToolbarStyle">
<item name="pspdf__backgroundColor">?colorPrimaryDark</item>
<item name="pspdf__submenuBackgroundColor">?colorPrimary</item>
<item name="pspdf__iconsColor">@color/pspdf__color_white</item>
<item name="pspdf__iconsColorActivated">@color/pspdf__color_white</item>
</style>

The following attributes can be modified for pspdf__contextualToolbarStyle. Note that some of them only have an effect when the toolbar is not docked at the top of the screen, but rather dragged to float vertically on the left or right side of the page.

AttributeDescription
pspdf__backgroundColorBackground color of the contextual toolbars. This defaults to the theme’s ?colorPrimaryDark.
pspdf__borderColorBorder color of the contextual toolbars.
Only used in vertical mode.
pspdf__submenuBackgroundColorBackground color of the contextual toolbars submenus. This defaults to ?colorPrimary.
pspdf__submenuBorderColorNot used in docked mode. Border color of the contextual toolbars submenus.
Only used in vertical mode.
pspdf__iconsColorDefault icons color in the contextual toolbars. This property can be overridden for each contextual toolbar (see below). This defaults to white.
pspdf__iconsColorActivatedDefault color of activated icons in the contextual toolbars. This property can be overridden for each contextual toolbar (see below). This defaults to white.
pspdf__alternateBackgroundColorBackground color of toolbar items marked with Position.END.
Only used in vertical mode.

Additionally, you can customize each of the toolbars with their own configuration, as shown below.

Annotation creation toolbar

<item name="pspdf__annotationCreationToolbarIconsStyle">@style/MyApp.Theme.AnnotationCreationToolbarIconsStyle</item>
AttributeDescription
pspdf__iconsColorIcon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle.
pspdf__iconsColorActivatedActivated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle.
pspdf__highlightIconIcon for the highlight annotation menu option.
pspdf__underlineIconIcon for the underline annotation menu option.
pspdf__strikeoutIconIcon for the strikeout annotation menu option.
pspdf__squigglyIconIcon for the squiggly annotation menu option.
pspdf__noteIconIcon for the note annotation menu option.
pspdf__inkIconIcon for the ink annotation menu option.
pspdf__freeTextIconIcon for the free text annotation menu option.

Annotation editing toolbar

<item name="pspdf__annotationEditingToolbarIconsStyle">@style/MyApp.Theme.AnnotationEditingToolbarIconsStyle</item>
AttributeDescription
pspdf__iconsColorIcon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle.
pspdf__iconsColorActivatedActivated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle.
pspdf__editIconIcon for the edit annotation menu option.
pspdf__shareIconIcon for the share annotation contents menu option.
pspdf__deleteIconIcon for the delete annotation menu option.

Text selection toolbar

<item name="pspdf__textSelectionToolbarIconsStyle">@style/MyApp.Theme.TextSelectionToolbarIconsStyle</item>
AttributeDescription
pspdf__iconsColorIcon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle.
pspdf__iconsColorActivatedActivated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle.
pspdf__shareIconIcon for the share selected text menu option.
pspdf__copyIconIcon for the copy selected text menu option.
pspdf__speakIconIcon for the speak selected text menu option.
pspdf__highlightIconIcon for the highlight selected text menu option.
pspdf__searchIconIcon for the search selected text menu option.

Document editing toolbar

<item name="pspdf__documentEditingToolbarIconsStyle">@style/MyApp.Theme.DocumentEditingToolbarIconsStyle</item>
AttributeDescription
pspdf__iconsColorIcon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle.
pspdf__iconsColorActivatedActivated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle.
pspdf__undoIconIcon for the undo document editing menu option.
pspdf__redoIconIcon for the redo document editing menu option.
pspdf__rotatePagesIconIcon for the rotate selected pages menu option.
pspdf__removePagesIconIcon for the remove selected pages menu option.
pspdf__exportPagesIconIcon for the export selected pages menu option.
pspdf__duplicatePagesIconIcon for the duplicate selected pages menu option.
pspdf__editPagesIconIcon for the edit selected pages menu option, which is shown if there’s not enough room in the toolbar for all the icons.
pspdf__doneIconIcon for the done with document editing menu option.

Toolbar coordinator layout

The positioning and moving of contextual toolbars is handled by the ToolbarCoordinatorLayout, which can also be themed:

<item name="pspdf__toolbarCoordinatorLayoutStyle">@style/MyApp.Theme.ToolbarCoordinatorLayoutStyle</item>
AttributeDescription
pspdf__dragTargetColorTint the color of available toolbar target locations when dragging the toolbar. This can also be set programmatically using ToolbarCoordinatorLayout#setDragTargetColor.
<item name="pspdf__inlineSearchStyle">@style/MyApp.InlineSearchStyle</item>
AttributeDescription
pspdf__backgroundColorDefault background color.
pspdf__borderColorDefault border color.
pspdf__borderWidthDefault border width.
pspdf__inputFieldTextAppearanceInput field text appearance.
pspdf__resultTextAppearanceText appearance for the result text (that states the current displayed result).
pspdf__throbberColorLoading throbber color.
pspdf__prevIconDrawableIcon for going to the previous result.
pspdf__nextIconDrawableIcon for going to the next result.
pspdf__prevIconColorFilterPrevious icon color.
pspdf__nextIconColorFilterNext icon color.
pspdf__backIconColorTintBack icon color.
<item name="pspdf__modularSearchStyle">@style/MyApp.ModularSearchStyle</item>
AttributeDescription
pspdf__backgroundColorModular search background color.
pspdf__inputFieldTextColorInput field text color.
pspdf__inputFieldHintColorInput field hint text color.
pspdf__inputFieldBackgroundColorInput field background color.
pspdf__separatorColorColor of the horizontal line separator below the input field.
pspdf__listItemBackgroundColorBackground color of the list items.
pspdf__listItemTitleColorText color of the list item title (page number).
pspdf__listItemSubtitleColorText color of the list item subtitle (search snippet).
pspdf__listItemSelectorSearch result list item selector.
pspdf__highlightBackgroundColorHighlighted search result background color.
pspdf__highlightTextColorHighlighted search result text color.

Note that pspdf__highlightBackgroundColor is used exclusively for highlighter styling inside the modular search view results list. If you want to change the search result highlighting color when displaying search results in the document view, refer to the highlighter customization section of the text search guide.

Thumbnail bar

<item name="pspdf__thumbnailBarStyle">@style/MyApp.ThumbnailBarStyle</item>
AttributeDescription
pspdf__backgroundColorThumbnail bar background color.
pspdf__thumbnailWidthWidth of thumbnails in thumbnail bar.
pspdf__thumbnailHeightHeight of thumbnails in thumbnail bar.
pspdf__usePageAspectRatioIf this is set to true, thumbnails will not be uniformly sized, but each will have its own aspect ratio. When this is true, the pspdf__thumbnailWidth is ignored and only the pspdf__thumbnailHeight has an effect.
pspdf__thumbnailBorderColorBorder colors of thumbnails in thumbnail bar.

Scrollable thumbnail bar

<item name="pspdf__scrollableThumbnailBarStyle">@style/MyApp.ScrollableThumbnailBarStyle</item>
AttributeDescription
pspdf__backgroundColorScrollable thumbnail bar background color.
pspdf__thumbnailWidthWidth of thumbnails in scrollable thumbnail bar.
pspdf__thumbnailHeightHeight of thumbnails in scrollable thumbnail bar.
pspdf__thumbnailBorderColorBorder colors of thumbnails in scrollable thumbnail bar.
pspdf__thumbnailSelectedBorderColorBorder colors of thumbnails in scrollable thumbnail bar when selected.

Thumbnail grid

<item name="pspdf__thumbnailGridStyle">@style/MyApp.ThumbnailGridStyle</item>
AttributeDescription
pspdf__backgroundColorThumbnail grid background color.
pspdf__itemLaberlTextStyleDefault style for the item label text.
pspdf__itemLabelBackgroundDefault background for the item label.
pspdf__selectionCheckBackgroundColorDefault background for the selected item icon.
pspdf_fabIconColorDefault icon color for the edit document FAB.
pspdf__itemRippleBackgroundColorDefault ripple background color for item selection.

Outline view

<item name="pspdf__outlineViewStyle">@style/MyApp.OutlineStyle</item>
AttributeDescription
pspdf__backgroundColorOutline view background color.
pspdf__listItemSelectorOutline view list selector.
pspdf__defaultTextColorDefault text color (if not specified by the document).
pspdf__tabIndicatorColorColor of the tab indicator.
pspdf__bookmarksBarBackgroundColorBackground color of the bookmark bar.
pspdf__bookmarksBarIconColorColor for icons on the bookmark bar.
pspdf__bookmarksAddIconDefault icon for the add option.
pspdf__bookmarksEditIconDefault icon for the edit option.
pspdf__bookmarksDoneIconDefault icon for the done option.
pspdf__bookmarksDeleteIconDefault icon for the delete option.
pspdf__bookmarksDeleteIconColorIcon color for the delete option.
pspdf__bookmarksDeleteBackgroundColorBackground icon color for the delete option.
pspdf__bookmarksDragHandleIconDefault icon for the bookmark drag handle.
pspdf__bookmarksDragHandleIconColorIcon color for the bookmark drag handle.
pspdf__annotationsBarBackgroundColorBackground color of the annotations bar.
pspdf__annotationsBarIconColorColor for icons on the annotations bar.
pspdf__annotationsDeleteIconDefault icon for the delete option.
pspdf__annotationsDeleteIconColorIcon color for the delete option on list items.
pspdf__annotationsEditIconDefault icon for the edit option.
pspdf__annotationsDoneIconDefault icon for the done option.

Document

<item name="pspdf__documentViewStyle">@style/MyApp.DocumentViewStyle</item>
AttributeDescription
android:scrollbarStyleDefault scrollbar style and position.
android:scrollbarsDefine which scrollbars (if any) should be displayed while scrolling.
android:scrollbarSizeWidth of vertical scrollbars and height of horizontal scrollbars.

Annotations

Use this to style the appearance of PDF annotations:

<item name="pspdf__annotationStyle">@style/MyApp.AnnotationStyle</item>
AttributeDescription
pspdf__linkAnnotationBackgroundColorNormal background color of link annotations.
pspdf__linkAnnotationBorderColorNormal border color of link annotations.
pspdf__linkAnnotationHighlightBackgroundColorBackground color of highlighted (i.e. touched) link annotations.
pspdf__linkAnnotationHighlightBorderColorBorder color of highlighted (i.e. touched) link annotations.

Annotation hints

Use this to style the appearance of PDF annotation hints:

<item name="pspdf__annotationNoteHinterStyle">@style/MyApp.AnnotationHintsStyle</item>
AttributeDescription
pspdf__noteHinterWidthNote hinter drawable width (in dp).
pspdf__pspdf__noteHinterHeightNote hinter drawable height (in dp).
pspdf__noteHinterColorTint color to use on note hinter drawable.
pspdf__noteHinterAlphaAlpha of the hint icon. Has to be in the range 0 to 255.
pspdf__noteHinterIconNote hinter drawable resource.
pspdf__noteHinterTextMarkupLeftPaddingPadding between text markup annotations and the note hint icon in dp.
pspdf__useNoteHinterIntrinsicSizeBoolean that specifies whether or not to use intrinsic size.

Search result highlighter

This defines styling for the search result highlighter:

<item name="pspdf__searchResultHighlighterStyle">@style/MyApp.SearchResultHighlighterStyle</item>
AttributeDescription
pspdf__searchResultBackgroundColorSearch result highlighter background color.
pspdf__searchResultBorderColorSearch result highlighter border color.
pspdf__searchResultBorderWidthSearch result highlighter border width (in dp).
pspdf__searchResultPaddingSearch result highlighter padding (in dp).
pspdf__searchResultAnnotationPaddingSearch result highlighter padding (in dp) when the annotation is highlighted.
pspdf__searchResultAnimationPaddingSearch result highlighter padding (in dp) when animated (the highlighter will size up to the desired padding and then come back).
pspdf__searchResultCornerRadiusToHeightRatioFloat that specifies the search result highlighter corner radius to height ratio. The default is 0.1, meaning the highlight area with a height of 20dp will have 2dp corner radii.
pspdf__searchResultCornerRadiusMinMinimum allowed corner radius (in dp) for the search result highlighter.
pspdf__searchResultCornerRadiusMaxMaximum allowed corner radius (in dp) for the search result highlighter.

This defines styling for the link annotations highlighter:

<item name="pspdf__linkAnnotationHighlighterStyle">@style/MyApp.LinkAnnotationHighlighterStyle</item>
AttributeDescription
pspdf__highlightedBackgroundColorLink annotation highlighter background color.
pspdf__highlightedBorderColorLink annotation highlighter border color.
pspdf__highlightedBorderWidthLink annotation highlighter border width (in dp).
pspdf__highlightedLinkAnnotationPaddingLink annotation highlighter padding (in dp).
pspdf__highlightedLinkAnnotationAnimationPaddingLink annotation highlighter padding (in dp) when animated (the highlighter will size up to the desired padding and then come back).
pspdf__highlightedRectangleCornerRadiusToHeightRatioFloat that specifies the link annotation highlighter corner radius to height ratio. The default is 0.1, meaning the highlight area with a height of 20dp will have 2dp corner radii.
pspdf__highlightedRectangleMinCornerRadiusMinimum allowed corner radius (in dp) for the link annotation highlighter.
pspdf__highlightedRectangleMaxCornerRadiusMaximum allowed corner radius (in dp) for the link annotation highlighter.

Text selection

<item name="pspdf__textSelectionStyle">@style/MyApp.TextSelectionStyle</item>
AttributeDescription
pspdf__highlightColorText selection highlight (background) color.
pspdf__leftHandleColorText selection left handle color.
pspdf__rightHandleColorText selection right handle color.

Password view

<item name="pspdf__passwordViewStyle">@style/MyApp.PasswordViewStyle</item>
AttributeDescription
pspdf__colorPassword text input area color.
pspdf__hintColorPassword text input area hint text color.
pspdf__floatingHintColorPassword text input area hint text color (when hint moves above the input area).
pspdf__errorColorPassword text input area error text color.
pspdf__iconPassword text input area icon.
pspdf__iconTintingEnabledPassword text input area icon tint.

Signature layout

<item name="pspdf__passwordViewStyle">@style/MyApp.SignatureLayoutStyle</item>
AttributeDescription
pspdf__addSignatureIconIcon for the add signature action.
pspdf__addSignatureIconColorIcon color for the add signature action.
pspdf__addSignatureIconBackgroundColorIcon background color for the add signature action.
pspdf__acceptSignatureIconIcon for the accept signature action.
pspdf__acceptSignatureIconColorIcon color for the accept signature action.
pspdf__acceptSignatureIconBackgroundColorIcon background color for the accept signature action.
pspdf__deleteSelectedSignaturesIconIcon for the delete selected signatures action.
pspdf__deleteSelectedSignaturesIconColorIcon color for the delete selected signatures action.
pspdf__deleteSelectedSignaturesIconBackgroundColorIcon background color for the delete selected signatures action.
pspdf__clearSignatureCanvasIconIcon for the clear signature canvas action.
pspdf__clearSignatureCanvasIconColorIcon color for the clear signature canvas action.
pspdf__clearSignatureCanvasIconBackgroundColorIcon background color for the clear signature canvas action.
pspdf__signatureInkColorPrimaryPrimary signature ink color.
pspdf__signatureInkColorSecondarySecondary signature ink color.
pspdf__signatureInkColorTertiaryTertiary signature ink color.
pspdf__backgroundColorSignature layout background color.
pspdf__textColorSignature layout text color.
pspdf__signerChipIconResSigner chip icon resource.
pspdf__signerChipIconTintSigner chip icon tint.
pspdf__signerChipIconBackgroundSigner chip icon background color.
pspdf__signerListSelectedItemBackgroundSigner list selected item background color.
pspdf__signerListSelectedItemForegroundSigner list selected item foreground color.
pspdf__signatureListSelectedItemBackgroundSignature list selected item background color.

Property inspector

<item name="pspdf__propertyInspectorStyle">@style/MyApp.PropertyInspectorStyle</item>
AttributeDescription
pspdf__minHeightMinimum height of property inspector (in dp).
pspdf__maxHeightMaximum height of property inspector (in dp).
pspdf__maxWidthMaximum width of property inspector (in dp).
pspdf__backgroundColorProperty inspector background color.
pspdf__textColorProperty inspector text color.
pspdf__itemHeightProperty inspector item height (in dp).
pspdf__searchVisibleWhether or not the search bar will be added to the property inspector.
pspdf__modalDialogStyleProperty inspector modal dialog style (see below).

The modal dialog style is set inside the previously mentioned pspdf__propertyInspectorStyle via:

<item name="pspdf__modalDialogStyle">@style/MyApp.ModalDialog.PropertyInspector</item>
AttributeDescription
pspdf__titleBackgroundProperty inspector modal dialog title background color.
pspdf__titleTextColorProperty inspector modal dialog title text color.
pspdf__titleIconsColorProperty inspector modal dialog title icons color.
pspdf__titleHeightProperty inspector modal dialog title height (in dp).
pspdf__titleTextSizeProperty inspector modal dialog title text size (in sp).
pspdf__titlePaddingProperty inspector modal dialog title padding (in dp).
pspdf__cornerRadiusProperty inspector modal dialog corner radius (in dp).

Action menu

This is used for styling the bottom action menu (pops up when sharing a document, for example):

<item name="pspdf__actionMenuStyle">@style/MyApp.ActionMenuStyle</item>
AttributeDescription
pspdf__maxWidthAction menu bar maximum width (in dp).
pspdf__backgroundColorAction menu background color.
pspdf__labelColorAction menu label color.
pspdf__fixedActionsPanelBackgroundColorBackground color of the fixed actions panel.
pspdf__fixedActionsIconColorIcons color in the fixed actions panel.
pspdf__fixedActionsIconBackgroundIcons background color in the fixed actions panel.

Stamp picker

<item name="pspdf__stampPickerStyle">@style/MyApp.StampPickerStyle</item>
AttributeDescription
pspdf__maxHeightStamp picker maximum height (in dp).
pspdf__maxWidthStamp picker maximum width (in dp).
pspdf__backgroundColorStamp picker background color.
pspdf__textColorStamp picker text color.
pspdf__hintColorStamp picker hint color.
pspdf__acceptCustomStampIconIcon for the accept stamp button.
pspdf__acceptCustomStampIconColorIcon color for the accept stamp button.
pspdf__acceptCustomStampIconBackgroundColorIcon background color for the accept stamp button.

Sharing dialog

<item name="pspdf__sharingDialogStyle">@style/MyApp.SharingDialogStyle</item>
AttributeDescription
pspdf__backgroundColorSharing dialog background color.
pspdf__errorColorSharing dialog error color.

New page dialog

<item name="pspdf__newPageDialogStyle">@style/MyApp.NewPageDialogStyle</item>
AttributeDescription
pspdf__backgroundColorNew page dialog background color.

Settings mode picker Items

This is used for styling settings mode picker items:

<item name="pspdf__settingsModePickerItemStyle">@style/MyApp.SettingsModePickerItemStyle</item>
AttributeDescription
pspdf__itemTintItem tint for each of the settings mode picker items (use the selector to specify tint color for various item states).

Settings mode line separator

This is used for styling the line separator between settings mode picker items:

<item name="pspdf__settingsModeLineSeparatorStyle">@style/MyApp.SettingsModeLineSeparatorStyle</item>

Attributes: Style it with all the regular Android attributes for styling views. To get a horizontal line, use android:layoutWidth="match_parent" and android:layoutHeight="1dp".

Document view

This accepts a style defining View attributes for modifying the appearance of scrollbars:

<item name="pspdf__documentViewStyle">@style/MyApp.DocumentViewStyle</item>
AttributeDescription
android:scrollbarStyleThe style of the document view scrollbar.
android:scrollbarsEnabled document view scrollbars (horizontal or vertical).
android:scrollbarSizeDocument view scrollbar size (in dp).

Form selection

<item name="pspdf__formSelectionStyle">@style/MyApp.FormSelectionStyle</item>
AttributeDescription
pspdf__highlightColorForm selection highlight color.
pspdf__requiredTextElementBorderColorForm selection border color for required text elements.
pspdf__selectedTextElementBackgroundColorForm selection background color for selected text elements.
pspdf__selectedTextElementBorderColorForm selection border color for selected text elements.
pspdf__touchedFormElementHighlightColorForm selection highlight color for touched elements.

Form Editing bar

<item name="pspdf__formEditingBarStyle">@style/MyApp.FormEditingBarStyle</item>
AttributeDescription
pspdf__backgroundColorForm editing bar background color.
pspdf__textColorForm editing bar text color.
pspdf__iconsColorForm editing bar icons color.
pspdf__prevIconDrawableForm editing bar previous element icon resource.
pspdf__nextIconDrawableForm editing bar next element icon resource.
pspdf__validationErrorBackgroundColorForm editing bar validation error background color.
pspdf__validationErrorTextColorForm editing bar validation error text color.

This is used for styling popup toolbars (e.g. when text is selected or when pasting elements):

<item name="pspdf__popupToolbarStyle">@style/MyApp.PopupToolbarStyle</item>
AttributeDescription
pspdf__backgroundColorPopup toolbar background color.
pspdf__itemTintPopup toolbar item tint.
pspdf__itemTintDisabledPopup toolbar item tint when item is disabled.

Tab bar

This is used for styling the tab bar that allows you to switch between different documents:

<item name="pspdf__tabBarStyle">@style/MyApp.TabBarStyle</item>
AttributeDescription
pspdf__backgroundColorTab bar background color.
pspdf__tabColorColor of the tab items.
pspdf__tabIndicatorColorColor of the indicator of the currently selected tab.
pspdf__tabTextColorColor of the text on tab items when not selected.
pspdf__tabTextColorSelectedColor of the text on tab items when selected.
pspdf__tabIconColorColor of the close icon on tab items when not selected.
pspdf__tabIconColorSelectedColor of the close icon on tab items when selected.
pspdf__tabBarHeightThe height of the tab bar.
pspdf__tabBarMinimumWidthThe minimum width of a single tab bar item.
pspdf__tabBarMaximumWidthThe maximum width of a single tab bar item.
pspdf__tabBarTextSizeThe size of the document title text on a tab item.

Annotation selection layout

Use this to style the appearance of the annotation selection layout:

<item name="pspdf__annotationSelectionStyle">@style/MyApp.AnnotationSelection</item>
AttributeDescription
pspdf__borderColorBorder color of the annotation selection layout.
pspdf__borderWidthBorder width of the annotation selection layout.
pspdf__scaleHandleColorScale handle color of the annotation selection layout (rotation handle included).
pspdf__editHandleColorEdit handle color of the annotation selection layout.
pspdf__paddingPadding of the annotation selection layout.
pspdf__guideLineWidthGuide line width of the annotation selection layout.
pspdf__guideLineColorGuide line color of the annotation selection layout.
pspdf__guideLineIncreaseGuide line dimension increase over the annotation selection layout.
pspdf__topLeftScaleHandleDrawableScale handle drawable in the top-left part of the annotation selection layout.
pspdf__topCenterScaleHandleDrawableScale handle drawable in the top-center part of the annotation selection layout.
pspdf__topRightScaleHandleDrawableScale handle drawable in the top-right part of the annotation selection layout.
pspdf__centerLeftScaleHandleDrawableScale handle drawable in the center-left part of the annotation selection layout.
pspdf__centerRightScaleHandleDrawableScale handle drawable in the center-right part of the annotation selection layout.
pspdf__bottomLeftScaleHandleDrawableScale handle drawable in the bottom-left part of the annotation selection layout.
pspdf__bottomCenterScaleHandleDrawableScale handle drawable in the bottom-center part of the annotation selection layout.
pspdf__bottomRightScaleHandleDrawableScale handle drawable in the bottom-right part of the annotation selection layout.
pspdf__rotationHandleDrawableScale handle drawable of the annotation selection layout for the rotation.
pspdf__backgroundDrawableBackground drawable for the annotation selection layout.

When a scale handle drawable is set to null and the pspdf__scaleHandleColor is set to Color.TRANSPARENT, the scale handle will not be operational. When a drawable is set for a scale handle together with a color other than transparent, the drawable will take precedence over the color. When a background drawable is set by pspdf__backgroundDrawable together with pspdf__borderColor, the drawable will take precedence over the color.

When setting custom drawables for scale handles, some configurations may produce unwanted results when resizing the annotation selection layout. Make sure to test your custom drawable configuration thoroughly.

Measurement tools

Use the following to style the appearance of the Measurement Tools attributes:

<item name="pspdf__measurementToolsStyle">@style/MyApp.MeasurementTools</item>
AttributeDescription
pspdf__measurementValuePopupBackgroundColorBackground color for the popup view showing the measured value.