Class PdfLayer
The PdfLayer used to create layers in PDF document. Layers refers to sections of content in a PDF document that can be selectively viewed or hidden by document authors or consumers
Inheritance
System.Object
PdfLayer
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfLayer : Object, IPdfWrapper
Properties
Layers
Gets the collection of child PdfLayer
Declaration
public PdfDocumentLayerCollection Layers { get; }
Property Value
Type | Description |
---|---|
PdfDocumentLayerCollection | The PdfDocumentLayerCollection used to handle collection of PdfLayer |
Locked
Gets or sets a lock state of a layer
Declaration
public bool Locked { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Create new PDF document
PdfDocument document = new PdfDocument();
//Add page
PdfPage page = document.Pages.Add();
//Add the layer
PdfLayer layer = document.Layers.Add("Layer");
//Set a lock state
layer.Locked = true;
//Create graphics for layer
PdfGraphics graphics = layer.CreateGraphics(page);
//Draw ellipse
graphics.DrawEllipse(PdfPens.Red, new RectangleF(50, 50, 40, 40));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create new PDF document
Dim document As PdfDocument = New PdfDocument()
'Add page
Dim page As PdfPage = document.Pages.Add()
'Add the layer
Dim layer As PdfLayer = document.Layers.Add("Layer")
'Set a lock state
layer.Locked = True
'Create graphics for layer
Dim graphics As PdfGraphics = layer.CreateGraphics(page)
'Draw ellipse
graphics.DrawEllipse(PdfPens.Red, New RectangleF(50, 50, 40, 40))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
Name
Gets or sets the name of the layer
Declaration
public string Name { get; set; }
Property Value
Type |
---|
System.String |
PrintState
Gets or sets printing state of the layer
Declaration
public PdfPrintState PrintState { get; set; }
Property Value
Type |
---|
PdfPrintState |
Visible
Gets or sets the visible of the layer
Declaration
public bool Visible { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
CreateGraphics(PdfPageBase)
Initializes Graphics context of the layer.
Declaration
public PdfGraphics CreateGraphics(PdfPageBase page)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The page. |
Returns
Type |
---|
PdfGraphics |