Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


The function opens a layer in the current open page or template.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 5.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.BeginLayer"; PDF; OCG )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
OCG OCG or OCMD handle. $OCG


Returns layer reference number or error.


The function opens a layer in the current open page or template.
The layer must be closed with DynaPDF.EndLayer when finish. The parameter OCG must be valid handle of an Optional Content Group (OCG) or Optional Content Membership Dictionary (OCMD) (see DynaPDF.CreateOCG and DynaPDF.CreateOCMD for further information). The OCG or OCMD controls the visibility of the contents that is included in the layer.
DynaPDF.BeginLayer/DynaPDF.EndLayer calls connect normal page contents, such as text, images, and vector graphics with a layer but no interactive objects like annotations or form fields. Annotations and Form Fields can be added to a layer with DynaPDF.AddObjectToLayer.
It is not required to draw the entire contents of a layer in one pass. The page contents can be drawn as usual and delimited into DynaPDF.BeginLayer/DynaPDF.EndLayer calls as necessary. Only contents that is delimited into DynaPDF.BeginLayer/DynaPDF.EndLayer calls becomes part of a layer.
Layers can be nested by calling DynaPDF.BeginLayer more than one time with different OCGs or OCMDs. The visibility of an inner layer depends then also on the visibility of the out ones (see example below). If an outer layer is invisible then all inner layers are invisible too, regardless of the visibility settings of the inner layers. 
A layer is not part of the graphics state. Neither DynaPDF.BeginLayer nor DynaPDF.EndLayer change any parameter of the graphics state. DynaPDF.BeginLayer must not be called within an open path.

See also BeginLayer function in DynaPDF manual.

See also

Release notes

Blog Entries

This function checks for a license.

Created 6th February 2015, last changed 6th February 2015

DynaPDF.BeginContinueText - DynaPDF.BeginPattern