The class provides methods and properties to handle the collection of PdfLayer
.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access the collection of layers in the document
let layers: PdfLayerCollection = document.layers;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
number
Gets the layer count.
Create a new PdfLayer
with name
add it to the end of the collection.
Parameter | Type | Description |
---|---|---|
name | string |
Name of the layer. |
Returns PdfLayer
Create a new PdfLayer
with name and Boolean flag to set the visibility of layer
add it to the end of the collection.
Parameter | Type | Description |
---|---|---|
name | string |
Name of the layer. |
visible | boolean |
Visibility of the layer. |
Returns PdfLayer
Gets the PdfLayer
at the specified index.
Parameter | Type | Description |
---|---|---|
index | number |
Layer index. |
Returns PdfLayer
Remove all the layers.
Returns void
Boolean indicating whether the specified layer exists or not.
Parameter | Type | Description |
---|---|---|
layer | PdfLayer |
The layer to be checked. |
Returns boolean
Boolean indicating whether the specified layer name exists or not.
Parameter | Type | Description |
---|---|---|
name | string |
The layer name to be checked. |
Returns boolean
Index of the specified layer.
Parameter | Type | Description |
---|---|---|
layer | PdfLayer |
The layer to be checked. |
Returns number
Move the PdfLayer
into the collection at specified index.
Parameter | Type | Description |
---|---|---|
index | number |
Index of the layer. |
layer | PdfLayer |
Layer to move. |
Returns void
Remove the PdfLayer
with layer instance from the collection.
Parameter | Type | Description |
---|---|---|
layer | PdfLayer |
Layer to remove. |
Returns void
Remove the PdfLayer
with layer instance from the collection.
Parameter | Type | Description |
---|---|---|
layer | PdfLayer |
Layer to remove. |
removeGraphicalContent | boolean |
Remove graphical content, if true. |
Returns void
Remove the PdfLayer
at the layer name from the collection.
Parameter | Type | Description |
---|---|---|
name | string |
Layer name to remove. |
Returns void
Remove the PdfLayer
at the layer name from the collection.
Parameter | Type | Description |
---|---|---|
name | string |
Layer name to remove. |
removeGraphicalContent | boolean |
Remove graphical content, if true. |
Returns void
Remove the PdfLayer
at the specified index from the collection.
Parameter | Type | Description |
---|---|---|
index | number |
The index of the layer to be removed. |
Returns void
Remove the PdfLayer
at the specified index from the collection.
Parameter | Type | Description |
---|---|---|
index | number |
The index of the layer to be removed. |
removeGraphicalContent | boolean |
Remove graphical content, if true. |
Returns void