Class OptionalContentGroupCollection
Inheritance
Namespace: PdfToSvg
Assembly: IronPdf.dll
Syntax
public sealed class OptionalContentGroupCollection : ReadOnlyCollection<OptionalContentGroup>
Inspecting the optional-content layers present in an SVG conversion result becomes straightforward through OptionalContentGroupCollection, a read-only snapshot of every OptionalContentGroup detected during PDF-to-SVG export. Because it extends ReadOnlyCollection<OptionalContentGroup>, the full set of standard collection operations, including indexed access, Count, Contains, and enumeration, is available without any additional setup.
Optional content groups (OCGs) map to the layer system embedded in many PDF files: technical drawings, legal documents, and multi-language publications commonly use layers to show or hide content conditionally. When IronPDF converts such a document to SVG, each layer surfaces as an OptionalContentGroup entry inside this collection, giving calling code a structured way to discover what layers were present and to drive any layer-aware post-processing logic.
The collection is consumed rather than constructed directly. Retrieve it from the SVG conversion result and iterate or query it to branch on specific layer names before writing output files or applying further transformations.
using IronPdf;
// Convert a layered PDF to SVG, then inspect its optional-content groups.
var result = PdfToSvg.Convert("layered-drawing.pdf");
OptionalContentGroupCollection groups = result.OptionalContentGroups;
foreach (OptionalContentGroup group in groups)
{
Console.WriteLine(group.Name);
}For background on PDF-to-SVG conversion in IronPDF, see the IronPDF documentation hub and the PDF to SVG how-to guide.