Table of Contents

Class PdfStructureElement

Namespace
PDiffy
Assembly
PDiffy.dll

A structure element. Name replaces the type in the snapshot when other elements refer to it (TH1, TH2).

public sealed record PdfStructureElement : IEquatable<PdfStructureElement>
Inheritance
PdfStructureElement
Implements
Inherited Members

Properties

ActualText

Text a screen reader reads instead of the content, such as the words on a photo of a trail sign.

public string? ActualText { get; init; }

Property Value

string

AllText

The element's text with its descendants', in the order the element lists them.

public string? AllText { get; init; }

Property Value

string

AltText

The alt text, such as a figure's description of a trail map; null when it has none.

public string? AltText { get; init; }

Property Value

string

Annotations

The annotations the element points to, such as links and form widgets, in the order it lists them.

public IReadOnlyList<PdfAnnotation> Annotations { get; init; }

Property Value

IReadOnlyList<PdfAnnotation>

AssociatedFiles

The files PDF 2.0 lets the element carry (/AF), such as a formula's MathML, in the order it lists them. Each Name is its file name.

public IReadOnlyList<PdfEmbeddedFile> AssociatedFiles { get; init; }

Property Value

IReadOnlyList<PdfEmbeddedFile>

Children

The child elements, in the order the element lists them, which is reading order.

public IReadOnlyList<PdfStructureElement> Children { get; init; }

Property Value

IReadOnlyList<PdfStructureElement>

ColSpan

How many columns a table cell spans; null when it doesn't say, which means 1.

public int? ColSpan { get; init; }

Property Value

int?

Expansion

The full form of an abbreviation, such as "Mount" for "Mt."; null when it has none.

public string? Expansion { get; init; }

Property Value

string

FieldRole

What kind of field a Form element tags, from its PrintField Role attribute, such as "cb" (check box), "rb" (radio button), "pb" (push button) or "tv" (text); null when it doesn't set one.

public string? FieldRole { get; init; }

Property Value

string

FirstPage

The first page the element's own marked content or annotations are on; null when it has none on a page. Its children's pages don't count.

public int? FirstPage { get; init; }

Property Value

int?

Headers

The header cells a table cell names, by their Name, or "?id" for an ID no element has; null when the cell has no Headers attribute. The name of a header in another table starts with that table's number in reading order ("table2:TH1"), or with "no-table:" when the header is outside every table.

public IReadOnlyList<string>? Headers { get; init; }

Property Value

IReadOnlyList<string>

Id

The element's ID (/ID), as the PDF writes it; null when it has none. Snapshots leave it out, since generators often make it up, and print a header's Name instead.

public string? Id { get; init; }

Property Value

string

IdShared

Set when another structure element has the same Id, so a cell's headers or a reference to this element can reach the wrong one.

public bool IdShared { get; init; }

Property Value

bool

ImageHashes

The hashes of the images the element's own marked content draws, in the order the element lists its marked content, as Hash gives them: the image a figure's alt text describes.

public IReadOnlyList<string> ImageHashes { get; init; }

Property Value

IReadOnlyList<string>

Language

The language the element sets for itself, such as "fr"; null when it uses its parent's.

public string? Language { get; init; }

Property Value

string

LastPage

The last page, found the same way as FirstPage.

public int? LastPage { get; init; }

Property Value

int?

ListNumbering

A list's numbering, such as "Decimal", "Disc" or "UpperRoman"; null when it doesn't set one. PdfListNumberings lists them.

public string? ListNumbering { get; init; }

Property Value

string

MappedNamespace

The namespace MappedType is in; null for PDF 1.7's, or when the type isn't mapped.

public string? MappedNamespace { get; init; }

Property Value

string

MappedType

The type the role map maps a custom Type to, at the end of the chain when one custom type maps to another. The chain ends at the first standard type, so a standard type is never mapped; null when the type isn't mapped.

public string? MappedType { get; init; }

Property Value

string

MarkedSpans

Marked content in the element that sets its own language, replacement text, alt text or expansion.

public IReadOnlyList<PdfMarkedSpan> MarkedSpans { get; init; }

Property Value

IReadOnlyList<PdfMarkedSpan>

McidsInXObject

How many of the element's marked-content references point into a form XObject, such as a stamp the page draws. Their text is read from the form's own content, which numbers its MCIDs separately from the page's.

public int McidsInXObject { get; init; }

Property Value

int

McidsWithoutPage

How many of the element's marked-content references name no page, so their text can't be found.

public int McidsWithoutPage { get; init; }

Property Value

int

Name

The name, such as TH1, that other elements' Headers use for it; null when none does.

public string? Name { get; init; }

Property Value

string

Namespace

The namespace Type is in (/NS), such as Pdf2 for PDF 2.0's types or a generator's own; null for PDF 1.7's, which an element without one uses.

public string? Namespace { get; init; }

Property Value

string

ParentMissing

Set when the element has no parent entry (/P), which PDF/UA requires, so a tool that walks up the tree from it can't place it.

public bool ParentMissing { get; init; }

Property Value

bool

ParentUnlisted

Set when the element's parent doesn't list it, such as a P under a Document whose /K is empty, so only the parent tree reaches it. Assistive technology that maps content to its tag still finds it, but a tool that walks the tree doesn't. PDiffy lists such elements after the rest of the tree, at the top level.

public bool ParentUnlisted { get; init; }

Property Value

bool

ParentWrong

Set when the element's parent entry (/P) names an element other than the one that lists it, such as the root for a nested element, so a tool that walks up the tree from it goes the wrong way.

public bool ParentWrong { get; init; }

Property Value

bool

Path

Where the element is, as a check finding and a diff of whole-document snapshots show it: structure > Document > Table > TR[2]. With OnlyPages, a diff numbers only the siblings it kept.

public string? Path { get; init; }

Property Value

string

RowSpan

How many rows a table cell spans; null when it doesn't say, which means 1.

public int? RowSpan { get; init; }

Property Value

int?

Scope

A table header cell's scope: "Row", "Column" or "Both", as in PdfTableScopes; null when it doesn't set one.

public string? Scope { get; init; }

Property Value

string

SharedChildren

How many of the children the element lists that the tree has already reached elsewhere: under an earlier element, at the top level, earlier in the element's own list, or as one of its ancestors. The tree shows each only where it was reached first, though PDF/UA allows an element only one parent.

public int SharedChildren { get; init; }

Property Value

int

Summary

A table's summary of its purpose and layout; null when it has none.

public string? Summary { get; init; }

Property Value

string

Text

The text of the element's own marked content. Text in child elements, such as a link in a paragraph or a paragraph in a table cell, is in AllText.

public string? Text { get; init; }

Property Value

string

TextRuns

The text runs the element's own marked content draws, in the order the element lists its marked content and each in drawing order, with the font, size and color each uses: the same runs TextRuns lists. Runs drawn by child elements are in each child's own list.

public IReadOnlyList<PdfTextRun> TextRuns { get; init; }

Property Value

IReadOnlyList<PdfTextRun>

Title

The element's title, a name for it that isn't part of the page's text; null when it has none.

public string? Title { get; init; }

Property Value

string

Type

The type as the PDF writes it: a standard type (see PdfStructureTypes) or a custom one the role map maps; "(none)" when the element has no type.

public required string Type { get; init; }

Property Value

string

UnreadChildren

How many child elements are left out because they're nested more than 256 deep. Their content then counts as untagged.

public int UnreadChildren { get; init; }

Property Value

int

Methods

Descendants()

The element's children, their children and so on, in reading order.

public IEnumerable<PdfStructureElement> Descendants()

Returns

IEnumerable<PdfStructureElement>

Elements(string)

Descendants of a type, such as Paragraph, matched on the type or its role-mapped type. Unlike Elements(string), it doesn't check the type, so use the PdfStructureTypes constants.

public IEnumerable<PdfStructureElement> Elements(string type)

Parameters

type string

Returns

IEnumerable<PdfStructureElement>