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
Functions
Reverts back to viewer from any other State.
Provides the current configuration of the document.
Provides the document source of the PDF file.
Provides the SavedData bundle from the document.
Checks if viewer is visible or not. Default value is true
Sets the custom source for the PDF file. if you pass null in the source param, it will refresh the document by using same source.
Set the ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener to listen to the lifecycle of the contextual toolbar. Can be implemented in a LaunchedScope to handle the lifecycle of the contextual toolbar, i.e. LaunchedEffect(Unit) { documentState.setOnContextualToolbarLifecycleListener(object : ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener { override fun onPrepareContextualToolbar(toolbar: ContextualToolbar<*>) { if (toolbar is AnnotationCreationToolbar) { // Register grouping rule to tell toolbar how to group menu items. toolbar.setMenuItemGroupingRule(object : PresetMenuItemGroupingRule(context) { override fun getGroupPreset(capacity: Int, itemsCount: Int) = AnnotationCreationToolbarItemPresets.FOUR_ITEMS_GROUPING; }) } } }) }
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.