Some test text!

menu

OCG layer browser

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

OCG layer browser

This tutorial only applies to Xamarin.iOS. See the Xamarin.Android 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 PTPDFLayerViewController allows you to browse OCG layers associated with the document being viewed by a PTPDFViewCtrl. You can selectively render layers based on their states.

layer-browser
PDF layer browser.

The PDF layer control is part of the Tools library, so make sure you have added the Tools library to your project.

linkShow the OCG layer browser

To create a new PDF layer view controller instance and display it from another view controller, supply a PTPDFViewCtrl instance to the PTPDFLayerViewController designated initializer:

var pdfLayerViewController = new pdftron.PDF.Controls.PTPDFLayerViewController (mPdfViewCtrl);

var navigationController = new UINavigationController (pdfLayerViewController);

if (UserInterfaceIdiomIsPad)
{
    navigationController.ModalPresentationStyle = UIModalPresentationStyle.Popover;
    navigationController.PopoverPresentationController.BarButtonItem = layerButton;
}

this.PresentViewController (navigationController, true, null);
The PDF layer view controller must be pushed onto a navigation controller's stack before being shown.
Presenting on iPads:
The PDF layer view controller is designed to be presented in a popover on iPads. To do so, you must provide the PTPDFLayerViewController's PopoverPresentationController with either: OR as in the example above.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our live demo to learn about use cases & capabilities for WebViewer

Learn more
close