PDFium Delphi Component Docs

ReadableContent property

Component: TPdfView  ·  Unit: PDFium
Returns semantic readable content fragments for screen-reader, text-to-speech, and accessibility workflows

Syntax

property ReadableContent: TPdfReadableContent; // read only

Description

Readable content is built from the page structure tree when the document is tagged and falls back to page text order when it is not. Each fragment carries text, kind, language, page number, bounding rectangle, line rectangles, and source information

Use the page-level members for current-page workflows and DocumentReadableContent when a speech or export pipeline needs a single ordered list for the whole document

Shared readable-content cache

TPdf.ReadableContent, ReadablePageContent, DocumentReadableContent, their reading-unit helpers and a bound TPdfView.ReadableContent share per-page managed snapshots

A hit reuses the resolved fragments, including MCID text and geometry, without rebuilding the readable MCID map or opening a native text page

The default limits are 8 pages and 8 MiB of estimated retained managed data; pages use least-recently-used eviction and also participate in the document's total CacheBudgetBytes as pckReadableContent

Each result owns its fragment array, LineRects and MarkedContentIDs; caller changes cannot modify the retained snapshot

Notified content edits, structural changes, document-language changes, deactivation and replacement clear retained data; raw native mutations require the normal UpdatePage notification

Cross-page reads use transient native handles and preserve the document page, viewer page, native focus and pending edit buffer; cache entries retain no native handles

Oversized results, disabled retention, global-budget rejection and incomplete bounded structure traversal return the current full readable result without retaining it; native read failures propagate and are not cached

Readable reads reject during an active page-object edit transaction; call after commit or rollback

Limits account for conservative managed-data charges and do not bound parser/transient allocations, returned caller copies, whole-process memory or execution time

A working set larger than the configured capacity can evict earlier pages during a document scan; cache statistics report lifetime hits, misses, evictions and bypasses, including across clears

ReadableContentCacheCapacity, ReadableContentCacheMaxBytes, ReadableContentCacheStatistics, ClearReadableContentCache

ReadableContentOptions defaults to no filtering, preserving existing reader output; set a complete record on TPdf before reading

ExcludeArtifacts removes top-level objects carrying an Artifact content mark and tagged elements under Artifact structure ancestors

MarginLeft, MarginTop, MarginRight and MarginBottom are nonnegative PDF-point distances in the unrotated CropBox axes, falling back to MediaBox; the object's bounding-box center determines inclusion and boundary centers remain included

Margins accept finite values from 0 through 1000000 points; invalid settings preserve the existing policy and cached content

Unknown or nonfinite object geometry is retained rather than guessed; margins that consume the content area produce an empty readable page

Mixed MCID text without semantic overrides keeps its retained object text and rectangles; an ActualText, Alt or expansion owner containing filtered descendants is omitted as a whole when its semantic replacement cannot be separated safely

When all tagged readable content is filtered, the result remains an empty structured result instead of reintroducing content through heuristic fallback

Changing the options clears readable snapshots; TPdfView and document/session reading-unit queries share the owning document's policy

Filtering changes reader output only: it does not remove PDF objects, change page/focus/selection or rewrite saved content; native save/reopen retains the original text and Artifact marks

The default object filter uses the top-level readable object/MCID map; IncludeFormXObjects separately enables bounded unique untagged Form expansion with inherited Artifact marks and transformed margins

Set TPdf.ReadableContentOptions.HeuristicOrder to rhoColumns to apply geometry-based ordering only to heuristic reader output; rhoNative remains the default and tagged logical order is unchanged

ColumnGap defaults to 18 points and accepts finite values from 1 through 1000000; RightToLeft chooses right-to-left column progression and horizontal tie order

The heuristic identifies separated columns with at least two objects on each side and overlapping vertical extents, recursively arranging each side from top to bottom

Objects crossing a candidate gutter form spanning flow bands: content above each band is read by column, followed by the band and then the columns below it; this handles full-width headings, footers and intermediate captions

Ordering uses displayed bounding boxes at 1/64 point resolution, including the page's intrinsic Rotate; it does not rewrite text direction, font orientation or source rectangles

ReadableContent.HeuristicOrderApplied reports successful geometric ordering and DetectedColumns reports the maximum columns in a flow band; tagged/native results and failed ordering report False and zero

Unsupported geometry, more than 2048 readable objects, recursion beyond 32 levels or more than 8388608 work visits retain the entire original native order without partial sorting

Failed geometric ordering bypasses retention, allowing a transient native geometry failure to recover on the next read

Exact source text, MCIDs and rectangles remain attached to their original fragments; reading units and bound viewers share the ordered snapshots, and native save/reopen preserves the original PDF content

This is a deterministic horizontal-layout heuristic, not general layout recognition for arbitrary overlapping, vertical or mixed-direction text; ambiguous layouts remain a caller policy decision

Reader fragments and reading units carry TableContext for tagged TH/TD cells and their paragraph descendants, including page-local table/cell identities, zero-based row/column slots, RowSpan and ColumnSpan

Explicit Headers IDs take precedence; otherwise Column/Row/Both scope and preceding overlapping grid positions determine header associations, with positional inference when Scope is absent

Header labels come from retained readable fragments, so filtered Artifact headers cannot leak into spoken metadata; nested paragraph cells inherit the owning cell's context

HeadersExplicit distinguishes declared ID associations from inferred scopes; HeadersComplete and ErrorMessage report missing, duplicate, cyclic, filtered or over-budget headers and unsupported grids

Tagged identities are structure-element indexes in the current page snapshot; geometric identities are indexes in the supplied TPdfTables/Cells arrays and Source distinguishes those domains

BuildSpokenReadingUnit optionally prefixes data text with associated header labels; synthetic announcements have ContextOnly=True spans and SpokenToPageChar returns False inside them, while body offsets map to exact native characters

The speech builder validates source text and current tagged header contexts, preserves selection/page state and leaves its var output unchanged on rejection; IncludeContext=False permits validated body-only speech when semantic context is incomplete

Cached fragments, returned fragments, reading units and source snapshots own separate header arrays; mutating one does not alter the others

Tagged enrichment permits 16384 elements, 4096 cells, 1024 columns, row indexes/spans below or up to 4096, depth-64 header references, 128 headers per cell, 1048576 UTF-16 units each for labels/expanded associations and 8388608 work visits

Unsupported metadata leaves source text intact with diagnostics; native speech mapping uses exact top-level object/MCID ownership or the opt-in nested Form profile, with shared invocations enabled separately, with the declared character/object/work limits

Reader fragments and reading units carry ListContext from their nearest LI/L structure owners, including one-based nesting depth, page-local item position, numbering, explicit label text and an outer-to-inner ancestor path

Lbl descendants are identified by IsLabel and retain their actual label text; paragraph descendants under LBody inherit the owning item context without borrowing labels from neighboring or nested lists

Retained explicit labels take precedence over generated labels and support arbitrary Unicode and numbering styles

For complete lists without conflicting labels, generation supports Decimal, Roman numerals through 3999, English/unspecified Latin alphabetic numbering through 4096, Disc, Circle, Square, None and Unordered

UpperAlpha/LowerAlpha in other languages, generic Ordered/Description styles without labels, partial native list snapshots and inconsistent mixed labels require explicit Lbl content instead of guessed numbering

Filtered labels are not regenerated from ListNumbering; incomplete ancestor labels propagate a diagnostic to descendant paths while preserving all retained body text

BuildSpokenReadingUnit prefixes body speech with the outer-to-inner label path, marks it ContextOnly and validates the current tagged path before constructing exact native body mappings; label units are not prefixed with their own path

IncludeContext=False provides body-only speech when source mapping is valid; incomplete or stale context rejects without changing the caller's speech output

List metadata permits 16384 elements, 4096 items, depth 64 and separate 1048576-UTF-16-unit budgets for labels, expanded paths and attached paths; returned/cache/unit/source arrays remain independently owned

Native tree parsing may omit overly deep structures before these wrapper limits; a heuristic Source with unavailable ListContext signals that semantic labels were not established

Numbering names follow ISO 32000-1 list attributes; this profile does not infer arbitrary visual lists or language-specific alphabets without explicit labels

Remarks

Example

var Content: TPdfReadableContent;
Content := PdfView1.ReadableContent;
if Length(Content.Fragments) > 0 then
  ShowMessage(Content.Fragments[0].Text);

See Also

ReadableContent, StructureElements, Language, Text

Opt-in IncludeFormXObjects expands unique untagged nested Forms with page-space geometry and native selection/speech ownership; NativeObjectPath and FormSourceIdentity are independently copied into fragments, reading units and continuation source parts

NestedFormsComplete=False and NestedFormsError report disabled shared/tagged, clipped, unsupported or over-budget paths; unrelated top-level output and supported siblings remain available

Set IncludeSharedFormXObjects together with IncludeFormXObjects to read each untagged shared invocation separately, including identical overlapping text; source identities bind the live invocation and full object path

Separate opt-in IncludeTaggedFormXObjects reads the bounded tagged Form profile in certified structure order, with explicit page/Form MCID namespaces and ParentTree ownership; same-page shared invocations also require IncludeSharedFormXObjects, and certified fragments carry independent live paths/identities and StructElementIndex=-1