Document State
A state object that can be hoisted to control and observe properties of the com.pspdfkit.jetpack.compose.views.DocumentView. Create instances of this object using rememberDocumentState.
Parameters
The PdfActivityConfiguration used for this state.
Properties
Tracks which view (thumbnail grid, outline, search) is currently active so a host-rendered com.pspdfkit.compose.toolbar.composables.NutrientMainToolbar can reflect the correct toolbar button state.
The top edge of the rendered page in window pixels, updated as the document scrolls, zooms and changes page; null while the document is not laid out.
Provides ability to perform specific tasks in Document.
The DocumentCoordinator managing the documents shown by this state's com.pspdfkit.jetpack.compose.views.DocumentView: add documents to it to open them in the same view, and bind a com.pspdfkit.compose.tabs.composables.NutrientTabBar to it to show a tab per document. It is null until the document UI has been initialized, so collect it and render the tab bar only once it is non-null:
True while the search view is visible.
The Compose main-toolbar ToolbarCoordinator driving this document's toolbar, scoped to the host fragment. It is null until the document UI has been initialized, so collect it (e.g. with collectAsState()) and render com.pspdfkit.compose.toolbar.composables.NutrientMainToolbar only once it is non-null:
Keep track of whether a full screen view is shown that is not the document view so we can handle the main toolbar clipping
Functions
Reverts back to viewer from any other State.
Returns the height (in pixels) of the contextual toolbar, as measured by the SDK layout. Pass this value to setContentViewTopPadding when overlay views (thumbnail grid, outline) are shown, so their content starts exactly below the contextual toolbar.
Provides the current configuration of the document.
Provides the document source of the PDF file.
Provides the SavedData bundle from the document.
Handles a back press with the same layered logic as the regular SDK: dismisses the contextual toolbar first if one is shown; otherwise closes the active overlay view (thumbnail grid, outline, etc.).
Re-runs the ToolbarItemsProvider and refreshes the main-toolbar items — the declarative analogue of invalidateOptionsMenu().
Checks if viewer is visible or not. Default value is true
Sets the top padding (in pixels) of the sibling content view that holds overlay views such as the thumbnail grid. After the first call the automatic Java-side adjustments triggered by contextual toolbar lifecycle events are suppressed, so Compose can own this value without racing against native view code.
Sets the main-toolbar item click listener. The listener receives the tapped item's R.id and returns true to consume the tap or false to let the SDK's default handling run. Safe to call before the com.pspdfkit.jetpack.compose.views.DocumentView is attached.
Sets the handler for taps on the main toolbar's navigation icon, or null to clear it. Safe to call before the com.pspdfkit.jetpack.compose.views.DocumentView is attached.
Customizes the main-toolbar items declaratively — the com.pspdfkit.jetpack.compose.views.DocumentView-hosted counterpart of com.pspdfkit.ui.PdfActivity.setToolbarItemsProvider. The provider receives the SDK's default items and returns the items to show (add custom items, drop or reorder defaults, or change per-item state). Call invalidateToolbarItems to re-run it when your own state changes. Safe to call before the com.pspdfkit.jetpack.compose.views.DocumentView is attached — the provider is applied once the fragment connects.
Sets the SDK-rendered main toolbar's navigation (up / back) icon and its accessibility label, or null to remove it. Taps arrive at setOnToolbarNavigationClickListener. Safe to call before the com.pspdfkit.jetpack.compose.views.DocumentView is attached.
Set the SavedData bundle to the document.
Toggles the view based on the provided MENU_OPTIONS in com.pspdfkit.ui.PdfActivity.
Updated the configuration of the document.