Some test text!

Hamburger Icon

Xamarin / Guides / Show/hide layers

OCG layer browser

Apryse SDK allows you to browse OCG layers associated with the document.

Show or hide PDF layers in Xamarin.Android

This tutorial only applies to Xamarin.Android. See the Xamarin.iOS equivalent here .

A PDF OCG (Optional Content Groups) dictionary represents a collection of graphic objects that can be made visible or invisible. Any graphic content of the PDF can be made optional, including page contents, XObjects, and annotations.

The PdfLayerDialogFragment allows you to browse OCG layers associated with the document. You can selectively render layers based on their states. In a tree view of nested layers, if the parent layer is hidden, the child layers are automatically hidden as well. If the parent layer is visible, child layers can be made visible or hidden.


Show the OCG layer browser

public void Show(PDFViewCtrl pdfViewCtrl, FragmentManager fragmentManager) {
    var pdfLayerDialogFragment = PdfLayerDialogFragment.NewInstance();
    pdfLayerDialogFragment.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
    if (fragmentManager != null) {
        pdfLayerDialogFragment.Show(fragmentManager, "pdf_layer_dialog");

Get the answers you need: Chat with us