function DocumentReadableContent: TPdfContentFragments;
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
Since v3.277.0, enabling Form and tagged-Form inclusion uses complete certified document MCR indexes for stable global logical order, including structures that visit pages out of physical order. Optional paragraph continuation runs after this ordering. Without a complete ordering certificate, the existing page-based reader fallback remains available with per-page NestedFormsComplete/NestedFormsError diagnostics
With IncludeSemanticReplacements, a complete cross-page ActualText/Alt/E owner emits once on its first logical source page. Its SemanticParts retains all page-specific native sources, while its top-level rectangles stay on the anchor page. Any filtered member on any source page suppresses the entire owner; replacement speech remains explicitly unmapped
Since v3.278.0, SemanticScopes also retains simultaneous and nested structure declarations. An empty primary with nonempty alternatives can yield a SemanticMetadataOnly fragment; document reading units skip that empty primary, while BuildSpokenSemanticScope can explicitly validate and speak an available alternative
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, MarkedContentIDs, SemanticParts, SemanticScopes and nested source paths/references; 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 object filter profile uses the existing top-level readable object/MCID map; arbitrary nested Form text flattening is outside this profile
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
TPdf.ParagraphContinuation is disabled by default and affects DocumentReadableContent and DocumentReadingUnits only; page-readable snapshots remain unchanged and reusable
When enabled, the last ordinary paragraph/plain fragment of one page may join the first on the next page if both lie in the configured unrotated CropBox edge bands, align horizontally, use compatible line heights, share language and lack table/list context
A terminal sentence boundary, uppercase/noncontinuing start, heading, table, list, blank page, geometry/language mismatch or exhausted budget keeps the original fragments separate
EdgeBand defaults to 72 points, AlignmentTolerance to 18, MaxParts to 16 and MaxJoinedTextUnits to 262144; numeric settings are validated before assignment and part limits accept 1..64
Adjacent CJK parts remain unspaced; retained end-of-line hyphens join without an artificial space and optional Dehyphenate removes the boundary hyphen from reader text only
Every joined fragment has SourceParts containing each original page, complete source text, source UTF-16 slice, combined-text offset, MCIDs and original page-space geometry
Fragment/reading-unit Page and primary geometry identify the first source page; other pages remain available in SourceParts, and selection/speech helpers resolve their actual native positions without navigating the viewer
SelectFragment, SelectReadingUnit and BuildSpokenReadingUnit validate every selected source slice and can select/map a sentence spanning multiple pages or a later sentence on only one source page
Inserted join spaces are ContextOnly spans with no native character; source text, source ranges and part arrays remain independent snapshots and rejection preserves selection or caller speech output
Joining permits up to 1048576 total raw source UTF-16 units and 4096 MCIDs/rectangles per part; exact mapping shares the 4194304 native-character visit budget across selected parts
This is conservative paragraph continuation, not universal paragraph recognition; it does not mutate saved PDFs, remove physical hyphens or automatically change the visible page
var Content: TPdfReadableContent;
Content := Pdf1.ReadableContent;
if Length(Content.Fragments) > 0 then
ShowMessage(Content.Fragments[0].Text);