Class PdfLayer
- Namespace
- Syncfusion.Pdf
- Assembly
- Syncfusion.Pdf.Portable.dll
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
public class PdfLayer
- Inheritance
-
PdfLayer
- Inherited Members
Properties
Layers
Gets the collection of child PdfLayer
public PdfDocumentLayerCollection Layers { get; }
Property Value
- PdfDocumentLayerCollection
The PdfDocumentLayerCollection used to handle collection of PdfLayer
Locked
Gets or sets a lock state of a layer
public bool Locked { get; set; }
Property Value
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
public string Name { get; set; }
Property Value
PrintState
Gets or sets printing state of the layer
public PdfPrintState PrintState { get; set; }
Property Value
Visible
Gets or sets the visible of the layer
public bool Visible { get; set; }
Property Value
Methods
CreateGraphics(PdfPageBase)
Initializes Graphics context of the layer.
public PdfGraphics CreateGraphics(PdfPageBase page)
Parameters
page
PdfPageBaseThe page.