Class OptionalContentGroup
Inheritance
Namespace: PdfToSvg
Assembly: IronPdf.dll
Syntax
public sealed class OptionalContentGroup : Object
Control which layers appear in an SVG export by configuring an OptionalContentGroup before passing it to IronPDF's PDF-to-SVG conversion pipeline. Each instance represents one optional content group (OCG) from a layered PDF, pairing a human-readable Name with a Visible flag that determines whether that layer is rendered in the output.
Construct an OptionalContentGroup with new OptionalContentGroup(string name), where name matches the layer label used in the source document. Set Visible to true to include the layer or false to suppress it entirely. The read-only Name property retrieves the label after construction, and ToString() returns the same value, making instances easy to log or display in diagnostic output.
A typical use case is a technical drawing exported as SVG where annotation layers, dimension lines, or watermark layers must be toggled independently. By building a list of OptionalContentGroup objects with targeted Visible settings, you can produce multiple SVG variants from a single PDF without editing the source file.
using PdfToSvg;
var annotations = new OptionalContentGroup("Annotations") { Visible = false };
var dimensions = new OptionalContentGroup("Dimensions") { Visible = true };See the IronPDF documentation for full PDF-to-SVG conversion guidance, and the PDF layer how-to for practical examples of working with optional content groups in exported files.
Constructors
OptionalContentGroup(String)
Declaration
public OptionalContentGroup(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name |
Properties
Name
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Visible
Declaration
public bool Visible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |