function ReadablePageContent(PageNumber: Integer): TPdfReadableContent;
| PageNumber | Integer. One-based document page number |
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
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 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
var Content: TPdfReadableContent;
Content := Pdf1.ReadableContent;
if Length(Content.Fragments) > 0 then
ShowMessage(Content.Fragments[0].Text);
Since v3.322.0, tagged reading accepts a page MCR with an explicit Stm only when its MCID is physically declared in that exact page content stream. Content arrays, continued operands, named Properties and inherited resources retain original stream provenance; duplicate declarations, unrelated streams and inline-image lookalikes reject
An optional page StmOwn must identify the same declared page and requires an explicit Stm. Form or appearance stream owners outside the supported profile remain rejected. Internally tagged shared Forms can be prepared with reviewed invocation ownership normalization