Toggle Layer (OCG) Visibility in a PDF via the UI

This guide covers how to toggle the visibility of optional content group (OCG) layers via our user interface (UI).

Information

Working with PDF layers (OCG layers) is available when using the PSPDFKit for Web Standalone operational mode.

PSPDFKit comes with an OCG layers sidebar that allows the end user to control the state of the visibility of the OCG layers present in a document.

End users can control the visibility of the OCG layers using the icons rendered next to each layer in the sidebar.

Toggling Visibility

OCG layers have an open/closed eye button icon that indicates whether the OCG layer is visible or not, and it allows you to toggle their visibility. OCG layers with an open eye icon are currently visible, while those with a closed eye icon are hidden. End users can click the button icons to toggle the layer’s visibility.

OCG layers also have an open/closed lock icon that indicates whether the visibility of the OCG layer can be toggled by the user. OCG layers with a closed lock icon cannot have their visibility toggled, while those with an open lock can be toggled.

Radio Button Groups

The radio group icons are assigned to a specific type of layers called radioGroup. radioGroup layers work like radio buttons: Only one layer of a radio group can be visible at the same time. The radioGroup layer with a checked radio button icon next to it is the one that’s currently visible.