iText 8.0.5 API
iText.Kernel.Pdf.Layer.PdfLayer Class Reference

An optional content group is a dictionary representing a collection of graphics that can be made visible or invisible dynamically by users of viewer applications. More...

Inheritance diagram for iText.Kernel.Pdf.Layer.PdfLayer:
iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary > iText.Kernel.Pdf.Layer.IPdfOCG

Public Member Functions

  PdfLayer (PdfDictionary layerDictionary)
  Creates a new layer by existing dictionary, which must be an indirect object. More...
 
  PdfLayer (String name, PdfDocument document)
  Creates a new layer by its name and document. More...
 
virtual void  AddChild (iText.Kernel.Pdf.Layer.PdfLayer childLayer)
  Adds a child layer. More...
 
virtual iText.Kernel.Pdf.Layer.PdfLayer  GetParent ()
  Gets the parent of this layer, be it a title layer, or a usual one. More...
 
virtual void  SetName (String name)
  Sets the name of the layer to be displayed in the Layers panel. More...
 
virtual bool  IsOn ()
  Gets the initial visibility of the layer when the document is opened. More...
 
virtual void  SetOn (bool on)
  Sets the initial visibility of the layer when the document is opened. More...
 
virtual bool  IsLocked ()
  Gets whether the layer is currently locked or not. More...
 
virtual void  SetLocked (bool locked)
  Use this method to lock an optional content group. More...
 
virtual bool  IsOnPanel ()
  Gets the layer visibility in Acrobat's layer panel More...
 
virtual void  SetOnPanel (bool onPanel)
  Sets the visibility of the layer in Acrobat's layer panel. More...
 
virtual ICollection< PdfName GetIntents ()
  Gets a collection of current intents specified for this layer. More...
 
virtual void  SetIntents (IList< PdfName > intents)
  Sets the intents of the layer. More...
 
virtual void  SetCreatorInfo (String creator, String subtype)
  Used by the creating application to store application-specific data associated with this optional content group. More...
 
virtual void  SetLanguage (String lang, bool preferred)
  Specifies the language of the content controlled by this optional content group More...
 
virtual void  SetExport (bool export)
  Specifies the recommended state for content in this group when the document (or part of it) is saved by a viewer application to a format that does not support optional content (for example, an earlier version of PDF or a raster image format). More...
 
virtual void  SetZoom (float min, float max)
  Specifies a range of magnifications at which the content in this optional content group is best viewed. More...
 
virtual void  SetPrint (String subtype, bool printState)
  Specifies that the content in this group is intended for use in printing More...
 
virtual void  SetView (bool view)
  Indicates that the group should be set to that state when the document is opened in a viewer application. More...
 
virtual void  SetUser (String type, params String[] names)
  Specifies one or more users for whom this optional content group is primarily intended. More...
 
virtual void  SetPageElement (String pe)
  Indicates that the group contains a pagination artifact. More...
 
virtual PdfIndirectReference  GetIndirectReference ()
  Gets the indirect reference to the current layer object. More...
 
virtual String  GetTitle ()
  Gets the title of the layer if it is a title layer, or null if it is a usual layer. More...
 
virtual IList< iText.Kernel.Pdf.Layer.PdfLayer GetChildren ()
  Gets the list of the current child layers of the layer. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
virtual T  GetPdfObject ()
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document, PdfIndirectReference reference)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  SetModified ()
 
virtual void  Flush ()
 
virtual bool  IsFlushed ()
 
- Public Member Functions inherited from iText.Kernel.Pdf.Layer.IPdfOCG
PdfDictionary  GetPdfObject ()
  Gets the object representing the layer. More...
 

Static Public Member Functions

static iText.Kernel.Pdf.Layer.PdfLayer  CreateTitle (String title, PdfDocument document)
  Creates a title layer. More...
 
static void  AddOCGRadioGroup (PdfDocument document, IList< iText.Kernel.Pdf.Layer.PdfLayer > group)
  Use this method to set a collection of optional content groups whose states are intended to follow a "radio button" paradigm. More...
 

Package Functions

override bool  IsWrappedObjectMustBeIndirect ()
  Defines if the object behind this wrapper must be an indirect object in the resultant document. More...
 
virtual PdfDocument  GetDocument ()
  Gets the iText.Kernel.Pdf.PdfDocument that owns that layer. More...
 
virtual PdfDictionary  GetUsage ()
  Gets the /Usage dictionary, creating a new one if necessary. More...
 
- Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
  PdfObjectWrapper (T pdfObject)
 
virtual void  SetPdfObject (T pdfObject)
 
virtual void  SetForbidRelease ()
 
virtual void  UnsetForbidRelease ()
 
virtual void  EnsureUnderlyingObjectHasIndirectReference ()
 

Static Package Functions

static iText.Kernel.Pdf.Layer.PdfLayer  CreateTitleSilent (String title, PdfDocument document)
  Creates a title layer without registering it in PdfOCProperties. More...
 
- Static Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
static void  MarkObjectAsIndirect (PdfObject pdfObject)
 
static void  EnsureObjectIsAddedToDocument (PdfObject @object)
  Some wrappers use object's indirect reference to obtain the PdfDocument to which the object belongs to. More...
 

Package Attributes

String  title
  Used for titling group of objects but not actually grouping them. More...
 
bool  on = true
 
bool  onPanel = true
 
bool  locked = false
 
iText.Kernel.Pdf.Layer.PdfLayer  parent
 
IList< iText.Kernel.Pdf.Layer.PdfLayer children
 

Detailed Description

An optional content group is a dictionary representing a collection of graphics that can be made visible or invisible dynamically by users of viewer applications.

An optional content group is a dictionary representing a collection of graphics that can be made visible or invisible dynamically by users of viewer applications. In iText they are referenced as layers.

To be able to be wrapped with this iText.Kernel.Pdf.PdfObjectWrapper the iText.Kernel.Pdf.PdfObject must be indirect.

Constructor & Destructor Documentation

◆ PdfLayer() [1/2]

iText.Kernel.Pdf.Layer.PdfLayer.PdfLayer ( PdfDictionary  layerDictionary )
inline

Creates a new layer by existing dictionary, which must be an indirect object.

Parameters
layerDictionary the layer dictionary, must have an indirect reference.

◆ PdfLayer() [2/2]

iText.Kernel.Pdf.Layer.PdfLayer.PdfLayer ( String  name,
PdfDocument  document 
)
inline

Creates a new layer by its name and document.

Parameters
name the layer name
document the PdfDocument which the layer belongs to

Member Function Documentation

◆ AddChild()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.AddChild ( iText.Kernel.Pdf.Layer.PdfLayer  childLayer )
inlinevirtual

Adds a child layer.

Adds a child layer. Nested layers can only have one parent.

Parameters
childLayer the child layer

◆ AddOCGRadioGroup()

static void iText.Kernel.Pdf.Layer.PdfLayer.AddOCGRadioGroup ( PdfDocument  document,
IList< iText.Kernel.Pdf.Layer.PdfLayer group 
)
inlinestatic

Use this method to set a collection of optional content groups whose states are intended to follow a "radio button" paradigm.

Use this method to set a collection of optional content groups whose states are intended to follow a "radio button" paradigm. That is, the state of at most one optional content group in the array should be ON at a time: if one group is turned ON, all others must be turned OFF.

Parameters
document the PdfDocument
group the radio group

◆ CreateTitle()

static iText.Kernel.Pdf.Layer.PdfLayer iText.Kernel.Pdf.Layer.PdfLayer.CreateTitle ( String  title,
PdfDocument  document 
)
inlinestatic

Creates a title layer.

Creates a title layer. A title layer is not really a layer but a collection of layers under the same title heading.

Parameters
title the title text
document the PdfDocument
Returns
the title layer

◆ CreateTitleSilent()

static iText.Kernel.Pdf.Layer.PdfLayer iText.Kernel.Pdf.Layer.PdfLayer.CreateTitleSilent ( String  title,
PdfDocument  document 
)
inlinestaticpackage

Creates a title layer without registering it in PdfOCProperties.

Parameters
title the title of the layer
document the document this title layer belongs to
Returns
the created layer

◆ GetChildren()

virtual IList<iText.Kernel.Pdf.Layer.PdfLayer> iText.Kernel.Pdf.Layer.PdfLayer.GetChildren ( )
inlinevirtual

Gets the list of the current child layers of the layer.

Gets the list of the current child layers of the layer. BE CAREFUL! Do not try to add a child layer using the resultant child list, use #addChild method instead.

Returns
the list of the current child layers, null if the layer has no children.

◆ GetDocument()

virtual PdfDocument iText.Kernel.Pdf.Layer.PdfLayer.GetDocument ( )
inlinepackagevirtual

Gets the iText.Kernel.Pdf.PdfDocument that owns that layer.

Returns
the iText.Kernel.Pdf.PdfDocument that owns that layer

◆ GetIndirectReference()

virtual PdfIndirectReference iText.Kernel.Pdf.Layer.PdfLayer.GetIndirectReference ( )
inlinevirtual

Gets the indirect reference to the current layer object.

Returns
the indirect reference to the object representing the layer

Implements iText.Kernel.Pdf.Layer.IPdfOCG.

◆ GetIntents()

virtual ICollection<PdfName> iText.Kernel.Pdf.Layer.PdfLayer.GetIntents ( )
inlinevirtual

Gets a collection of current intents specified for this layer.

Gets a collection of current intents specified for this layer. The default value is iText.Kernel.Pdf.PdfName.View , so it will be the only element of the resultant collection if no intents are currently specified.

Returns
the collection of intents.

◆ GetParent()

virtual iText.Kernel.Pdf.Layer.PdfLayer iText.Kernel.Pdf.Layer.PdfLayer.GetParent ( )
inlinevirtual

Gets the parent of this layer, be it a title layer, or a usual one.

Returns
the parent of the layer, or null if it has no parent

◆ GetTitle()

virtual String iText.Kernel.Pdf.Layer.PdfLayer.GetTitle ( )
inlinevirtual

Gets the title of the layer if it is a title layer, or null if it is a usual layer.

Returns
the title of the layer if it is a title layer, or null if it is a usual layer

◆ GetUsage()

virtual PdfDictionary iText.Kernel.Pdf.Layer.PdfLayer.GetUsage ( )
inlinepackagevirtual

Gets the /Usage dictionary, creating a new one if necessary.

Returns
the /Usage dictionary

◆ IsLocked()

virtual bool iText.Kernel.Pdf.Layer.PdfLayer.IsLocked ( )
inlinevirtual

Gets whether the layer is currently locked or not.

Gets whether the layer is currently locked or not. If the layer is locked, it will not be possible to change its state (on/off) in a viewer.

Returns
true if the layer is currently locked, false otherwise.

◆ IsOn()

virtual bool iText.Kernel.Pdf.Layer.PdfLayer.IsOn ( )
inlinevirtual

Gets the initial visibility of the layer when the document is opened.

Returns
the initial visibility of the layer

◆ IsOnPanel()

virtual bool iText.Kernel.Pdf.Layer.PdfLayer.IsOnPanel ( )
inlinevirtual

Gets the layer visibility in Acrobat's layer panel

Returns
the layer visibility in Acrobat's layer panel

◆ IsWrappedObjectMustBeIndirect()

override bool iText.Kernel.Pdf.Layer.PdfLayer.IsWrappedObjectMustBeIndirect ( )
inlinepackagevirtual

Defines if the object behind this wrapper must be an indirect object in the resultant document.

Defines if the object behind this wrapper must be an indirect object in the resultant document.

If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.

Return value of this method shouldn't depend on any logic, it should return always true or false.

Returns
true if in the resultant document the object behind the wrapper must be indirect, otherwise false.

Implements iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >.

◆ SetCreatorInfo()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetCreatorInfo ( String  creator,
String  subtype 
)
inlinevirtual

Used by the creating application to store application-specific data associated with this optional content group.

Parameters
creator a text string specifying the application that created the group
subtype a string defining the type of content controlled by the group. Suggested values include but are not limited to Artwork, for graphic-design or publishing applications, and Technical, for technical designs such as building plans or schematics

◆ SetExport()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetExport ( bool  export )
inlinevirtual

Specifies the recommended state for content in this group when the document (or part of it) is saved by a viewer application to a format that does not support optional content (for example, an earlier version of PDF or a raster image format).

Parameters
export the export state

◆ SetIntents()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetIntents ( IList< PdfName intents )
inlinevirtual

Sets the intents of the layer.

Parameters
intents the list of intents.

◆ SetLanguage()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetLanguage ( String  lang,
bool  preferred 
)
inlinevirtual

Specifies the language of the content controlled by this optional content group

Parameters
lang a language string which specifies a language and possibly a locale (for example, es-MX represents Mexican Spanish)
preferred used by viewer applications when there is a partial match but no exact match between the system language and the language strings in all usage dictionaries

◆ SetLocked()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetLocked ( bool  locked )
inlinevirtual

Use this method to lock an optional content group.

Use this method to lock an optional content group. The state of a locked group cannot be changed through the user interface of a viewer application. Producers can use this entry to prevent the visibility of content that depends on these groups from being changed by users.

Parameters
locked sets whether the layer is currently locked or not

◆ SetName()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetName ( String  name )
inlinevirtual

Sets the name of the layer to be displayed in the Layers panel.

Parameters
name the name of the layer.

◆ SetOn()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetOn ( bool  on )
inlinevirtual

Sets the initial visibility of the layer when the document is opened.

Parameters
on the initial visibility of the layer

◆ SetOnPanel()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetOnPanel ( bool  onPanel )
inlinevirtual

Sets the visibility of the layer in Acrobat's layer panel.

Sets the visibility of the layer in Acrobat's layer panel. If false the layer cannot be directly manipulated by the user. Note that any children layers will also be absent from the panel.

Parameters
onPanel the visibility of the layer in Acrobat's layer panel

◆ SetPageElement()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetPageElement ( String  pe )
inlinevirtual

Indicates that the group contains a pagination artifact.

Parameters
pe one of the following names: "HF" (Header Footer), "FG" (Foreground), "BG" (Background), or "L" (Logo).

◆ SetPrint()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetPrint ( String  subtype,
bool  printState 
)
inlinevirtual

Specifies that the content in this group is intended for use in printing

Parameters
subtype a name specifying the kind of content controlled by the group; for example, Trapping, PrintersMarks and Watermark
printState indicates that the group should be set to that state when the document is printed from a viewer application

◆ SetUser()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetUser ( String  type,
params String[]  names 
)
inlinevirtual

Specifies one or more users for whom this optional content group is primarily intended.

Parameters
type a name that can be Ind (individual), Ttl (title), or Org (organization).
names one or more text strings representing the name(s) of the individual, position or organization

◆ SetView()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetView ( bool  view )
inlinevirtual

Indicates that the group should be set to that state when the document is opened in a viewer application.

Parameters
view the view state

◆ SetZoom()

virtual void iText.Kernel.Pdf.Layer.PdfLayer.SetZoom ( float  min,
float  max 
)
inlinevirtual

Specifies a range of magnifications at which the content in this optional content group is best viewed.

Parameters
min the minimum recommended magnification factors at which the group should be ON. A negative value will set the default to 0
max the maximum recommended magnification factor at which the group should be ON. A negative value will set the largest possible magnification supported by the viewer application

Member Data Documentation

◆ title

String iText.Kernel.Pdf.Layer.PdfLayer.title
package

Used for titling group of objects but not actually grouping them.