---
title: "JavaScript library for PDF layers (OCGs) | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/layers/"
md_url: "https://www.nutrient.io/guides/web/layers.md"
last_updated: "2026-05-30T02:20:01.405Z"
description: "Unlock the power of layers in web development with our comprehensive guide. Elevate your skills and create captivating designs. Explore now!"
---

# JavaScript library for PDF layers (OCGs)

Nutrient Web SDK 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.

[Try for Free](https://www.nutrient.io/sdk/web/getting-started.md)

[Launch Demo](https://www.nutrient.io/demo/hello)

Working with PDF layers (OCG layers) is available when using [Web SDK](/guides/web.md) in the browser. For more information, refer to the [operational mode](/guides/web/about/operational-modes.md) guide.

## Guides for OCG layers

**[Introduction to PDF layers (OCGs)](https://www.nutrient.io/guides/web/layers/introduction-to-ocg-layers.md)**\
Learn about PDF OCG layers

**[Show and hide](https://www.nutrient.io/guides/web/layers/visibility.md)**\
How to programmatically hide, show, or lock PDF OCG layers

**[Built-in UI](https://www.nutrient.io/guides/web/layers/built-in-ui.md)**\
Learn how end users can toggle PDF OCG layers with the built-in UI

**Call to Action**

Start your free trial for unlimited access and expert support.

[Learn More](https://www.nutrient.io/sdk/web/getting-started/other-frameworks/javascript.md)
---

## Related pages

- [Toggle layer (OCG) Visibility in a PDF via the UI](/guides/web/layers/built-in-ui.md)
- [Introduction to PDF layers (OCGs)](/guides/web/layers/introduction-to-ocg-layers.md)
- [Toggle layer (OCG) visibility in a PDF using JavaScript](/guides/web/layers/visibility.md)

