PdfSaveOptions.ExportDocumentStructure property

Gets or sets a value determining whether or not to export document structure.

public bool ExportDocumentStructure { get; set; }


This value is ignored when saving to PDF/A-1a, PDF/A-2a and PDF/UA-1 because document structure is required for this compliance.

Note that exporting the document structure significantly increases the memory consumption, especially for the large documents.


Shows how to preserve document structure elements, which can assist in programmatically interpreting our document.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.ParagraphFormat.Style = doc.Styles["Heading 1"];
builder.Writeln("Hello world!");
builder.ParagraphFormat.Style = doc.Styles["Normal"];
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();

// Set the "ExportDocumentStructure" property to "true" to make the document structure, such tags, available via the
// "Content" navigation pane of Adobe Acrobat at the cost of increased file size.
// Set the "ExportDocumentStructure" property to "false" to not export the document structure.
options.ExportDocumentStructure = exportDocumentStructure;

// Suppose we export document structure while saving this document. In that case,
// we can open it using Adobe Acrobat and find tags for elements such as the heading
// and the next paragraph via "View" -> "Show/Hide" -> "Navigation panes" -> "Tags".
doc.Save(ArtifactsDir + "PdfSaveOptions.ExportDocumentStructure.pdf", options);

See Also