Table of Contents

Class PdfLayer

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

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. @author Paulo Soares (psoares@consiste.pt)

public class PdfLayer : PdfDictionary, IPdfOcg
Inheritance
PdfLayer
Implements
Inherited Members

Constructors

PdfLayer(string, PdfWriter)

Creates a new layer.

public PdfLayer(string name, PdfWriter writer)

Parameters

name string

the name of the layer

writer PdfWriter

the writer

Fields

Refi

protected PdfIndirectReference Refi

Field Value

PdfIndirectReference

children

protected IList<PdfLayer> children

Field Value

IList<PdfLayer>

parent

protected PdfLayer parent

Field Value

PdfLayer

title

protected string title

Field Value

string

Properties

Children

Gets the children layers.

public IList<PdfLayer> Children { get; }

Property Value

IList<PdfLayer>

the children layers or null if the layer has no children

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).

public bool Export { set; }

Property Value

bool

Name

Sets the name of this layer.

public string Name { set; }

Property Value

string

On

Gets the initial visibility of the layer.

public bool On { get; set; }

Property Value

bool

the initial visibility of the layer

OnPanel

Gets the layer visibility 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.

public bool OnPanel { get; set; }

Property Value

bool

Parent

Gets the parent layer.

public PdfLayer Parent { get; }

Property Value

PdfLayer

the parent layer or null if the layer has no parent

PdfObject

Gets the dictionary representing the layer. It just returns this .

public PdfObject PdfObject { get; }

Property Value

PdfObject

the dictionary representing the layer

Ref

Gets the PdfIndirectReference that represents this layer.

public PdfIndirectReference Ref { get; set; }

Property Value

PdfIndirectReference

the PdfIndirectReference that represents this layer

View

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

public bool View { set; }

Property Value

bool

Methods

AddChild(PdfLayer)

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

public void AddChild(PdfLayer child)

Parameters

child PdfLayer

the child layer

CreateTitle(string, PdfWriter)

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

public static PdfLayer CreateTitle(string title, PdfWriter writer)

Parameters

title string

the title text

writer PdfWriter

the PdfWriter

Returns

PdfLayer

the title layer

SetCreatorInfo(string, string)

Used by the creating application to store application-specific data associated with this optional content group. 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

public void SetCreatorInfo(string creator, string subtype)

Parameters

creator string

a text string specifying the application that created the group

subtype string

a string defining the type of content controlled by the group. Suggested

SetLanguage(string, bool)

Specifies the language of the content controlled by this optional content group (for example, es-MX represents Mexican Spanish) match between the system language and the language strings in all usage dictionaries

public void SetLanguage(string lang, bool preferred)

Parameters

lang string

a language string which specifies a language and possibly a locale

preferred bool

used by viewer applications when there is a partial match but no exact

SetPrint(string, bool)

Specifies that the content in this group is intended for use in printing for example, Trapping, PrintersMarks and Watermark set to that state when the document is printed from a viewer application

public void SetPrint(string subtype, bool printstate)

Parameters

subtype string

a name specifying the kind of content controlled by the group;

printstate bool

indicates that the group should be

SetZoom(float, float)

Specifies a range of magnifications at which the content in this optional content group is best viewed. should be ON. A negative value will set the default to 0 should be ON. A negative value will set the largest possible magnification supported by the viewer application

public void SetZoom(float min, float max)

Parameters

min float

the minimum recommended magnification factors at which the group

max float

the maximum recommended magnification factor at which the group