Bookmark Navigation in Our MAUI PDF Viewer

The bookmarks sidebar shows a list of bookmarks available in a document, and they’re grouped and ordered by page. The sidebar can be used to navigate to the bookmarked pages.

Sidebar.

The bookmarks sidebar can be shown by the user by selecting the bookmarks sidebar icon from the sidebar dropdown in the toolbar.

It can also be shown programmatically with the API:

<!--View-->
<pspdfkit:PDFView x:Name="PDFView" SidebarMode="{Binding SelectedSidebarMode}" />
// ViewModel
public SidebarMode? SelectedSidebarMode
{
	get => _selectedSidebarMode;
  set => SetField(ref _selectedSidebarMode, value);
}

public void OpenDocumentOutlineSidebar() {
	SelectedSidebarMode = SidebarMode.Bookmarks;	
}

If you don’t want users to be able to open the bookmarks sidebar, you can hide the corresponding toolbar button by filtering it out from the default toolbar items:

// Find the item to remove.
var sidebarBookmarksToggleButton = 
  PSPDFKitController.MainToolbar.ToolbarItems.First(
    item => item.GetType() == typeof(SidebarBookmarksToggleButton));

// Remove the item.
PSPDFKitController.MainToolbar.ToolbarItems.Remove(
  sidebarBookmarksToggleButton);

The bookmarks sidebar toolbar button can be styled with CSS using the public CSS class .PSPDFKit-Toolbar-Button-Sidebar-Bookmarks.

The bookmarks sidebar itself can also be customized with CSS by modifying the corresponding public CSS classes: