JavaScript Library for PDF Layers (OCGs)

PSPDFKit for Web includes support for toggling the visibility of optional content group (OCG) layers. It offers developers a robust API for programmatic display of OCG layers, as well as a beautiful UI for users to enable and disable layer visibility.

Launch Demo

PSPDFKit SDKs are deployed in some of the world’s most popular applications, such as those made by Autodesk, Disney, UBS, Dropbox, IBM, and Lufthansa.


Working with PDF layers (OCG layers) is available when using the Web SDK in standalone operational mode.

Key Capabilities

  • Built-in UI — Enable or disable OCG layer visibility using the UI

  • Programmatic — Programmatically toggle or lock OCG layer visibility

  • Layer Nesting — Retain the nested hierarchy of OCG layers

  • Extendable — Add form fill, annotation, editing, and more

Guides for OCG Layers

Introduction to PDF Layers (OCGs)
Learn about PDF OCG layers

Show and Hide
How to programmatically hide, show, or lock PDF OCG layers

Built-in UI
Learn how end users can toggle PDF OCG layers with the built-in UI

Free Trial

Enjoy unlimited trial usage of all our products. Get guidance and tech support from developers who built the product, and get started within minutes.