PDF Layers |
Layers (optional content) are parts of a PDF document a viewer can show or hide: watermarks, translations, draft marks, the levels of a technical drawing. ExpertPdf reads and changes the layers of a loaded document through Layers.
List the layers in a viewer's order; the layers nested under one are in its Layers.
Show or hide a layer when the document opens (Visible), lock it (Locked), rename it (Name).
Add a layer, and move page objects into it with their Layer property.
Remove a layer with what it draws, or keep its content as plain, always visible page content; Flatten does that for every layer.
Document document = new Document("drawing.pdf"); foreach (Layer layer in document.Layers) Console.WriteLine(layer.Name + (layer.Visible ? "" : " (hidden)")); document.Layers["Dimensions"].Visible = false; document.Layers.Remove(document.Layers["Draft"], true); document.Save("out.pdf"); document.Close();