Since v3.265.0, both public SanitiseActiveContentPdfStream overloads require the Enterprise sanitisation implementation to be registered and raise EPdfEnterpriseRequired before stream access when it is absent. Compression, pruning and linearization remain core features; see the edition matrix
FPdfCompress contains the public stream transformers used after PDFium serializes a document, plus records that configure each transformer and report its result
The full-rewrite helpers materialize the active object graph, preserve or deliberately rebuild cross-references, and reject inputs that cannot be rewritten safely; report-based procedures return failures through Succeeded and ErrorMessage
Since v3.326.0, active xref-stream parsing limits each decode to the serialized object at the requested revision offset, so a later revision reusing the same stream object number cannot replace an older revision's data. Unique stream revisions and comments between endstream and endobj retain their existing behavior
Since v3.326.1, an unfiltered xref stream may use an indirect Length whose integer object is represented by the same xref section, before or after the stream. The parser derives an exact bootstrap span from W and Index, then validates the referenced scalar at that section's exact offset and generation, preserving payload CR/LF bytes and reused object numbers across revisions
Since v3.326.2, ordinary Length integer dependencies can also resolve through older classic or stream revisions. Single FlateDecode streams use exact consumed-byte counts with complete zlib termination and checksum validation on FPC and Delphi XE5 or later, retaining bounded PNG/TIFF predictors and encoded-input limits. Hybrid lookup uses the current classic section before its supplemental stream and older revisions; free or wrong-generation entries cannot revive an older integer
Since v3.327.0, xref-stream length integers may also be compressed members of an unfiltered or single-Flate object stream, including older revision views and compressed catalogs. The reader validates the exact member index, complete integer value, container generation and stream span, and permits an ordinary indirect integer for the container's own length. Decoded object-stream bytes and member-header work consume cumulative sparse-index parser allowances. Structure scanning masks verified declared stream spans before interpreting payload tokens, preserving literal endstream and endobj bytes inside valid data
Version 3.328.0 extends xref and object-stream decoding to ASCIIHex, ASCII85, RunLength and LZW, including supported general-filter chains with Flate and direct PNG predictor parameters. Exact outer EOD byte counts establish the encoded span; every inner layer must consume its complete input, with Flate termination and checksum checks. LZW supports EarlyChange zero and one, 9 through 12-bit codes and dictionary resets. Intermediate outputs consume cumulative sparse-index decoded work while retaining the original encoded-byte expansion anchor and parser deadline
Version 3.329.0 resolves indirect object-stream N and First integers in the requesting revision, including ordinary nonzero-generation objects and compressed integers in an independent container. Sparse readers and full active-graph rewriting share the same interpretation. Free entries and generation mismatches cannot revive older values; complete scalar values, reference boundaries, dependency cycles, depth, work and retained header-byte limits are checked before member allocation
ISO 32000-1 section 7.3.8.2 requires encoded Length, EOD and decoded extent to agree. CR, LF or CRLF immediately before endstream may be excluded from Length; whitespace counted after a complete encoded EOD is still extra stream data and is rejected. The qualification retains all three excluded EOL forms with the five supported general filters
Version 3.330.0 resolves indirect Predictor, Columns, Colors, BitsPerComponent and EarlyChange integers in direct object-stream DecodeParms dictionaries or dictionary arrays. Ordinary and independently compressed parameters retain the requesting revision and generation, including changing predictors across updates. Parameter dependencies consume the same decoded-work and integer-dependency allowances before the primary container's remaining limit is calculated, and resolved dictionary output has a cumulative byte limit
Version 3.330.1 applies optional parameter defaults when a recognized value is null or its reference is undefined, free or has no matching generation. Defaults apply only to these optional fields; required N, First and Length integers still reject null. Ordinary and independently compressed null values retain the requesting revision and all dependency budgets. A direct null Filter is equivalent to omitting the filter, so its unused DecodeParms do not trigger reference resolution
Version 3.331.0 resolves permitted object-stream Filter, DecodeParms and Type references through complete revision-scoped values, including names, arrays, dictionary/array elements, nulls and independent compressed metadata. Ordinary aliases may chain through further references, including N/First and ordinary container-Length integers; compressed objects that consist solely of a reference remain rejected as required by section 7.5.7. Optional null file specifications are omitted, while actual external files remain unsupported and are never opened by this decoder
Version 3.332.0 additionally accepts a leading Identity Crypt filter in ordinary object streams, including omitted/null Name defaults, escaped direct names and subsequent supported general filters. Identity bytes count toward cumulative decoding work and retain exact member/stream boundaries. Cross-reference streams reject Crypt as required by section 7.5.8.2; named encryption algorithms and indirect Crypt Name/Type parameter values remain outside this profile
Version 3.333.0 resolves optional Crypt Name and Type values through revision-scoped ordinary or independently compressed objects, including null, undefined/free/wrong-generation defaults, escaped names and ordinary aliases. Name/Type keys are interpreted only in the Crypt parameter slot; same-named private fields in subsequent Flate/LZW dictionaries remain opaque. Complete values, generation checks, shared dependency-cycle detection, deadlines and cumulative metadata/decoded-byte budgets remain mandatory. Compressed objects consisting solely of references and named encryption algorithms remain rejected
Version 3.334.0 dispatches parameter references by their filter-array position: Predictor/Colors/BitsPerComponent/Columns apply to LZW/Flate and EarlyChange only to LZW. Active parameter Type entries resolve as optional revision-scoped names for every filter; a non-name Type now rejects instead of remaining opaque. Unused values are retained without following their references, while applicable fields keep generation, cycle, complete-value and resource validation. Opaque extension acceptance remains a compatibility behavior; private-name registration and complete schema conformance are not established by decoding
Version 3.334.1 additionally rejects missing generation/R token boundaries in opaque parameter references, including signed generations and array elements, while preserving valid whitespace and comments
Version 3.336.2 restores direct null decode-parameter defaults in the common PdfReadAndDecodeStream pure-Flate helper used by auxiliary content and metadata reads. Predictor, Colors, BitsPerComponent and Columns default to 1, 1, 8 and 1, including dictionary or single-item array parameters, with malformed null suffixes rejected. Revision-scoped reference resolution retains its existing separate contract
Version 3.336.1 rejects zero or negative Predictor values in LZW/Flate xref and object streams instead of treating them as no prediction. Predictor 1 remains the explicit no-prediction value, including the existing omitted/null defaults
Version 3.336.0 decodes TIFF Predictor 2 with 1/2/4/8/16-bit components in general-filter xref and object streams, including multiple components, filter chains, revision changes and indirect Length/header metadata. Single-Flate sparse decoding now shares the checked predictor path: incomplete TIFF rows and unsupported component depths reject instead of silently retaining undecoded bytes. Component reconstruction resets each row, uses big-endian 16-bit samples and preserves unused row-padding bits under the existing geometry and resource ceilings
Version 3.335.0 checks source dictionary uniqueness before removing or materializing Type/F/Filter/DecodeParms entries, and checks ordinary or compressed referenced parameter dictionaries before following their fields. Escaped equivalent keys, nested duplicates and decoded null names reject under bounded key-table workspace and comparison work. Raw source bytes and requesting-revision semantics remain unchanged; complete schema and extension registration audits remain separate
Reference-aware object-stream reads in each active graph share one lazily initialized source index and deadline, with cumulative dependency, decoded-work and normalized-output limits. The caller's per-object-stream decoded ceiling also applies to nested metadata containers before index initialization. Sparse source windows check the allocation ceiling before allocating buffers. Active object streams remain excluded from the returned ordinary object collection even when their Type is indirect
Physical TPdfStreamInspector reads and the standalone direct-dictionary parser retain their direct-metadata boundaries; a direct null F entry no longer marks an external file. Cross-reference Filter/DecodeParms entries retain their direct-only restrictions. Image/native codecs, remaining platform/compiler qualification and other normative audit items remain separate requirements; rejection at a documented support boundary does not declare legal PDF syntax invalid
Most applications use the corresponding TPdf save, inspection, or object-graph methods, while the unit procedures remain available for callers that already own serialized PDF streams
TPdfTreeEditor = class
class function TryLoad(Source: TStream; Kind: TPdfTreeKind;
const RootReference: TPdfTreeObjectReference;
const Options: TPdfTreeEditOptions; out Editor: TPdfTreeEditor;
out Report: TPdfTreeValidationReport): Boolean; static;
class function Load(Source: TStream; Kind: TPdfTreeKind;
const RootReference: TPdfTreeObjectReference;
const Options: TPdfTreeEditOptions): TPdfTreeEditor; static;
function UpsertName(const Key, RawValue: AnsiString): Boolean;
function UpsertNumber(Key: Int64; const RawValue: AnsiString): Boolean;
function RemoveName(const Key: AnsiString): Boolean;
function RemoveNumber(Key: Int64): Boolean;
procedure Clear;
function Validate(out Report: TPdfTreeValidationReport): Boolean;
function BuildBalancedObjects(FirstNewObjectNumber: Integer;
out Objects: TPdfTreeSerializedObjects;
out Report: TPdfTreeValidationReport): Boolean;
function SaveIncremental(Source, Dest: TStream;
out Report: TPdfTreeValidationReport): Boolean;
property Count: Integer;
property Entries[Index: Integer]: TPdfTreeEntry; default;
end;
TPdfOutlineEditor = class
class function TryLoad(Source: TStream;
const Options: TPdfOutlineEditOptions; out Editor: TPdfOutlineEditor;
out Report: TPdfOutlineValidationReport): Boolean; static;
class function Load(Source: TStream;
const Options: TPdfOutlineEditOptions): TPdfOutlineEditor; static;
function Add(ParentId, SiblingIndex: Integer; const Title: WideString;
PageNumber: Integer): Integer;
function Delete(Id: Integer): Boolean;
function Move(Id, NewParentId, SiblingIndex: Integer): Boolean;
procedure SetTitle(Id: Integer; const Title: WideString);
procedure SetStyle(Id: Integer; const Style: TPdfOutlineStyle);
procedure SetExpanded(Id: Integer; Expanded: Boolean);
procedure SetColor(Id: Integer; Red, Green, Blue: Single);
procedure ClearColor(Id: Integer);
procedure Retarget(Id, PageNumber: Integer;
const DestinationSuffix: AnsiString = '/Fit';
DestinationInAction: Boolean = False);
procedure SetUri(Id: Integer; const Uri: WideString);
procedure SetRemoteGoTo(Id: Integer; const FilePath: WideString;
RemotePageNumber: Integer;
const DestinationSuffix: AnsiString = '/Fit');
procedure SetLaunch(Id: Integer; const FilePath: WideString);
function ApplyPageMap(const NewPageNumbers: array of Integer;
DeleteDangling: Boolean; out Report: TPdfOutlineValidationReport): Boolean;
function Validate(out Report: TPdfOutlineValidationReport): Boolean;
function SaveIncremental(Source, Dest: TStream;
out Report: TPdfOutlineValidationReport): Boolean;
property Count: Integer;
property Items[Index: Integer]: TPdfOutlineItem; default;
end;
TPdfCrossDocumentGraftMap = class
constructor Create(const SourceIdentity: AnsiString);
procedure Clear;
function TryResolve(const Source: TPdfGraftObjectReference;
out Destination: TPdfGraftObjectReference): Boolean;
procedure Add(const Source, Destination: TPdfGraftObjectReference);
property Count: Integer;
property Entries[Index: Integer]: TPdfGraftMapEntry; default;
property SourceIdentity: AnsiString;
end;
TPdfSparseDictionaryReader = class
constructor Create(Source: TStream);
function ReadDictionary(ObjectNumber, Generation: Integer;
out Dictionary: AnsiString): Boolean;
function ReadLatestDictionary(ObjectNumber: Integer;
out Generation: Integer; out Dictionary: AnsiString): Boolean;
function ReadDecodedStream(ObjectNumber, Generation,
MaximumDecodedBytes: Integer; out Data: TBytes): Boolean;
property Valid: Boolean;
end;
procedure CompressPdfStream(Source, Dest: TStream);
procedure LinearizePdfStream(Source, Dest: TStream);
procedure PackPdfObjectStreams(Source, Dest: TStream;
MaxObjectsPerStream: Integer = 100;
MaxDecodedBytesPerStream: Integer = 65536);
procedure NormalizePdfDocumentContent(Source, Dest: TStream;
const Options: TPdfContentNormalizeOptions;
out Report: TPdfContentNormalizeReport);
function GraftPdfAcroForm(Source, Destination, Output: TStream;
const PageMappings: TPdfGraftPageMappings;
const Options: TPdfAcroFormGraftOptions;
GraftMap: TPdfCrossDocumentGraftMap;
out Report: TPdfAcroFormGraftReport): Boolean;
procedure PruneUnreachablePdfStream(Source, Dest: TStream;
out Report: TPdfPruneReport);
procedure PruneUnusedPdfResources(Source, Dest: TStream;
out Report: TPdfResourcePruneReport;
AllowSignedDocument: Boolean = False;
const ResourceMarker: AnsiString = '');
procedure DeduplicateResourcesPdfStream(Source, Dest: TStream;
out Report: TPdfDedupReport);
procedure RecompressFlatePdfStream(Source, Dest: TStream;
const Options: TPdfFlateRecompressOptions;
out Report: TPdfFlateRecompressReport);
procedure ExternaliseInlineImagesPdfStream(Source, Dest: TStream;
const Options: TPdfInlineImageExternaliseOptions;
out Report: TPdfInlineImageExternaliseReport);
procedure ReproduciblePdfStream(Source, Dest: TStream;
out Report: TPdfReproducibleReport);
procedure AppendPdfDirtyRevision(BaselineState, CurrentState,
PreviousOutput, Dest: TStream; out ChangedObjectCount: Integer;
out AppendedByteCount: Int64);
procedure ApplyDefaultOpenAction(Source, Dest: TStream;
PdfVersion: Integer = 0);
procedure PageLabelledPdfStream(Source, Dest: TStream;
const Ranges: TPdfPageLabelRanges; ReplaceExisting: Boolean;
out Report: TPdfPageLabelReport);
procedure InspectOptionalContentPdfStream(Source: TStream;
Usage: TPdfOptionalContentUsage; ConfigurationIndex: Integer;
out Inventory: TPdfOptionalContentInventory);
procedure ConfigureOptionalContentPdfStream(Source, Dest: TStream;
const Changes: TPdfOptionalContentStateChanges;
const Options: TPdfOptionalContentConfigureOptions;
out Report: TPdfOptionalContentConfigureReport);
procedure SanitiseActiveContentPdfStream(Source, Dest: TStream;
const Options: TPdfSanitiseOptions;
out Report: TPdfSanitiseReport);
procedure SanitiseActiveContentPdfStream(Source, Dest,
PruneWorkspace: TStream; const Options: TPdfSanitiseOptions;
out Report: TPdfSanitiseReport);
procedure ExportPdfObjectGraph(Source, Dest: TStream;
const Options: TPdfObjectGraphInspectOptions;
out Report: TPdfObjectGraphReport);
procedure PatchPdfObjectGraph(Source, Dest: TStream;
const Operations: TPdfObjectPatchOperations;
out Report: TPdfObjectGraphReport;
AllowSignedDocument: Boolean = False);
procedure PostProcessSavedPdf(Source, Dest: TStream;
PdfVersion: Integer = 0);
procedure PostProcessSavedPdf(Source, Dest, NormalizedWorkspace,
RepairedWorkspace, ValidationWorkspace: TStream;
PdfVersion: Integer = 0);
procedure RepairSubsetToUnicodeCMaps(Source, Dest: TStream);
function ReadPdfVersionInfo(Source: TStream; out Info: TPdfVersionInfo;
out ErrorText: string): Boolean;
function ReadPdfSparseRevisionInfo(Source: TStream;
out Info: TPdfSparseRevisionInfo): Boolean;
function ComposePdfSparseUpdateId(Source: TStream;
const Info: TPdfSparseRevisionInfo;
const DocumentId, InstanceId: TBytes): AnsiString;
function ReadPdfSparseCatalogSubDict(Source: TStream;
const Name: AnsiString; out SubDict: AnsiString): Boolean;
function ReadPdfSparsePageDictionaries(Source: TStream;
out Pages: TPdfSparsePageDictionaries): Boolean;
function ReadPdfSparseCatalogMetadata(Source: TStream; out Packet: TBytes): Boolean;
function ReadPdfSparseCatalogVersion(Source: TStream; out Version: Integer): Boolean;
function ReadPdfSparseNeedAppearances(Source: TStream;
out NeedAppearances: Boolean): Boolean;
function ReadPdfSparseFormFlags(Source: TStream;
out NeedAppearances, HasXfa, HasNeedsRendering: Boolean): Boolean;
function ReadPdfSparseXfaConfig(Source: TStream; ReadConfig: Boolean;
out HasXfa: Boolean; out Config: TBytes): Boolean;
function ReadPdfSparseAccessibilityFlags(Source: TStream;
out Marked, Suspects, DisplayDocTitle: Boolean): Boolean; overload;
function ReadPdfSparseAccessibilityFlags(Source: TStream;
out Marked, Suspects, DisplayDocTitle, HasStructureRoot: Boolean): Boolean; overload;
function ReadPdfSparseOptionalContentIssues(Source: TStream; NamesRequireAlternates: Boolean;
out MissingName, HasAsKey: Boolean): Boolean;
function ReadPdfSparseAnnotationTabOrder(Source: TStream; AllowAnnotationOrder: Boolean;
out MissingTabsOrder: Boolean): Boolean;
| Callable | Description |
|---|---|
TPdfTreeEditor.TryLoad | Loads and validates one indirect NameTree or NumberTree through sparse exact-generation lookup, returning structural evidence without raising for malformed input |
TPdfTreeEditor.Load | Loads one tree and raises an exception with the validation error when the structure is not safe to edit |
TPdfTreeEditor.UpsertName and UpsertNumber | Insert or replace one sorted entry while preserving its complete raw PDF value, including indirect references and compound objects |
TPdfTreeEditor.RemoveName, RemoveNumber, and Clear | Remove selected entries or empty the tree before deterministic rebalancing |
TPdfTreeEditor.Validate | Checks key ordering, duplicate keys, raw values, entry limits, and current editor invariants |
TPdfTreeEditor.BuildBalancedObjects | Builds bounded leaf and internal nodes with exact /Limits, retains the root identity, and reuses compatible loaded indirect node references where possible |
TPdfTreeEditor.SaveIncremental | Appends the balanced objects as a verified incremental revision and independently reloads the result before reporting success |
TPdfOutlineEditor.TryLoad and Load | Read an outline hierarchy through sparse exact-generation lookup, validate parent and sibling links, detect cycles, and preserve unsupported destinations and actions as opaque dictionary entries |
TPdfOutlineEditor.Add, Delete, and Move | Edit complete outline subtrees by stable item identifiers while maintaining depth-first sibling order |
TPdfOutlineEditor.SetTitle, SetStyle, SetExpanded, SetColor, and ClearColor | Update visible outline presentation without discarding unrecognised item dictionary entries |
TPdfOutlineEditor.Retarget | Assigns a one-based explicit page destination as direct /Dest data or a GoTo action with a validated destination suffix |
TPdfOutlineEditor.ApplyPageMap | Consumes the one-based destination mapping produced by page-plan validation, updates surviving explicit destinations, and either removes dangling subtrees or reports them |
TPdfOutlineEditor.SaveIncremental | Rebuilds root, parent, sibling, child, count, style, colour, and destination entries, appends an incremental revision, and independently reloads the semantic result before success |
TPdfCrossDocumentGraftMap.Create | Binds reusable source-to-destination indirect-object mappings to one caller-supplied source identity |
TPdfCrossDocumentGraftMap.Add and TryResolve | Store and resolve exact object-number and generation pairs, accept identical repeats, and reject conflicting destinations |
GraftPdfAcroForm | Imports field hierarchies, widgets, appearances, calculation order, default resources, actions, and values into mapped destination pages, appends a sparse incremental revision, and independently reloads the result before success |
CompressPdfStream | Flate-compresses eligible uncompressed streams and rebuilds the serialized PDF structure; encrypted and signed documents, and xref-stream, hybrid or object-stream layouts, pass through unchanged |
LinearizePdfStream | Reorders and renumbers the active object graph into linearized PDF layout with first-page and shared-object hint data |
PackPdfObjectStreams | Packs eligible non-stream objects into bounded ObjStm groups and writes a cross-reference stream; both grouping limits must be positive |
NormalizePdfDocumentContent | Normalizes every page content sequence with TPdfContentNormalizeOptions and returns a document-level TPdfContentNormalizeReport |
PruneUnreachablePdfStream | Rewrites only objects reachable from the catalog into one classic revision while preserving surviving object numbers and generations |
PruneUnusedPdfResources | Scans decoded content operators in page, inherited, Form XObject, pattern, appearance, and nested resource scopes, removes only unused resource names, appends a sparse revision, and prunes objects made unreachable |
DeduplicateResourcesPdfStream | Prunes unreachable objects and merges byte-identical font, image, form XObject, extended graphics state (/ExtGState), color space (including /ICCBased profile streams), shading, and pattern subgraphs |
RecompressFlatePdfStream | Decodes and recompresses reachable FlateDecode streams when both requested saving thresholds are met |
ExternaliseInlineImagesPdfStream | Moves inline image blocks into image XObjects, resolves page-level named /Resources /ColorSpace entries and inline filter arrays, updates page resources, and rewrites affected content streams |
ReproduciblePdfStream | Produces deterministic single-revision output by pruning unreachable objects, removing Info timestamps, and omitting the source /ID |
AppendPdfDirtyRevision | Compares baseline and current semantic snapshots, appends changed or new indirect objects to the previous output, and reports appended counts |
AppendEncryptedPdfDirtyRevision | Appends changed or new indirect objects under the inherited encryption context and validates or renews revision authentication |
ApplyDefaultOpenAction | Injects a first-page Fit-Height open action when none exists and the selected PDF version permits it, using bounded stream windows and sparse lazy lookup across classic, xref-stream, hybrid, and object-stream revisions |
PageLabelledPdfStream | Writes a catalog /PageLabels number tree from zero-based ranges and optionally replaces an existing tree, using bounded stream windows and sparse catalog lookup on the normal xref path |
InspectOptionalContentPdfStream | Reads optional-content groups, configurations, memberships, usage metadata, and effective visibility into an inventory; a document without /OCProperties fails with ErrorMessage equal to PdfOcNoPropertiesMessage, which tells it apart from one that cannot be read |
ConfigureOptionalContentPdfStream | Applies requested group visibility to a selected configuration and writes the required optional-content updates |
CreateOptionalContentPdfStream | Creates new optional-content groups (OCGs) and membership dictionaries (OCMDs, including multi-level nested /VE visibility expressions), registers them in direct or indirect catalog /OCProperties and /D configurations, and attaches OC-gated Form XObjects (with optional page /Resources snapshot inheritance) in direct or indirect page /Resources; also exposed via TPdf.SaveAsOptionalContentCreated |
CreateShadingPdfStream | Appends axial (Type 2) or radial (Type 3) shading dictionaries with a two-stop exponential or multi-stop Type 3 stitched interpolation function, optional /Matrix, optional /Background, configurable /Extend flags and optional target bounding rectangle (TargetRect), registers them in direct or indirect target page /Resources /Shading, and invokes them in page content; also exposed via TPdf.SaveAsShadingCreated |
SanitiseActiveContentPdfStream | Strips selected catalog and trailer active-content entries through sparse lookup and bounded range copying, then can prune objects made unreachable by that removal; the workspace overload accepts caller-owned bounded or disk-backed storage for the prune input |
ExportPdfObjectGraph | Serializes bounded indirect-object data as pdf-object-graph-v1 JSON with optional encoded-stream SHA-256 digests |
PatchPdfObjectGraph | Sets or removes top-level dictionary entries by object identity and appends a verified incremental revision |
PostProcessSavedPdf | Runs default-open-action handling, version-specific normalization, and native incremental xref-stream repair; the overload with three distinct seekable workspaces lets callers apply their own bounded or disk-backed storage policy |
RepairSubsetToUnicodeCMaps | Rewrites subset-font ToUnicode CMaps whose array elements contradict their bfchar entries, using equal-length in-place element edits (bfchar values win, a pair differing only in the high bit resolves to the smaller code point, any other conflict keeps the first mapping); documents without /ToUnicode or with xref-stream, hybrid, or object-stream layouts pass through untouched, and every full non-incremental TPdf save applies the same repair automatically |
ReadPdfVersionInfo | Reads header, catalog override, effective core version, and Adobe developer-extension information |
ReadPdfSparseRevisionInfo | Reads bounded latest-revision facts, catalog bytes, object generations, xref style, encryption state, document identifiers, and tagged-structure evidence through the sparse object index |
ComposePdfSparseUpdateId | Formats an incremental trailer /ID by preserving caller or source identifiers and deriving missing values through a bounded streaming digest |
ReadPdfSparseCatalogSubDict | Reads a direct or indirect catalog sub-dictionary, such as MarkInfo or ViewerPreferences, through the sparse object index |
ReadPdfSparsePageDictionaries | Traverses the active page tree through sparse classic, xref-stream, hybrid, and object-stream lookup and returns page dictionaries in page order |
ReadPdfSparseCatalogMetadata | Reads the catalog /Metadata XMP packet bytes through the sparse object index for callers that inspect metadata without loading the document |
ReadPdfSparseCatalogVersion | Reads the catalog /Version override through the sparse object index |
ReadPdfSparseNeedAppearances | Reads the AcroForm /NeedAppearances flag through the sparse object index |
ReadPdfSparseFormFlags | Reads /NeedAppearances, XFA presence and /NeedsRendering from the AcroForm dictionary in one sparse pass |
ReadPdfSparseXfaConfig | Reports whether the AcroForm carries an XFA array, and with ReadConfig also reads the xdc config packet bytes through a bounded 16 MiB decoded-stream budget |
ReadPdfSparseAccessibilityFlags | Reads /MarkInfo /Marked and /Suspects plus the /ViewerPreferences /DisplayDocTitle flag; the overload also reports whether a structure root is present, evidence PDF/UA identification checks consume |
ReadPdfSparseOptionalContentIssues | Checks the default optional-content configuration for a decodable /Name and the presence of an /AS key; NamesRequireAlternates decides whether an /AS alternating configuration satisfies the name requirement |
ReadPdfSparseAnnotationTabOrder | Checks page /Tabs ordering evidence across the page tree; AllowAnnotationOrder accepts annotation order in addition to structure order |
TPdfSparseDictionaryReader.Create | Builds one reusable sparse index over a caller-owned source stream and reports initialization success through Valid; the source must remain alive while the reader is used |
TPdfSparseDictionaryReader.Destroy | Releases the retained index buffers without freeing the caller-owned source stream |
TPdfSparseDictionaryReader.ReadDictionary | Resolves one exact object number and generation through the retained index and returns bounded active dictionary bytes |
TPdfSparseDictionaryReader.ReadLatestDictionary | Resolves the active xref entry for an object number, returns its generation, and reads its dictionary through the retained index |
TPdfSparseDictionaryReader.ReadDecodedStream | Reads and decodes one direct unfiltered or single FlateDecode stream while enforcing MaximumDecodedBytes |
TPdfOptionalContentConfigureOptions.Default | Selects configuration 0 and View usage, removes automatic-state rules, and enforces radio groups |
TPdfSanitiseOptions.Default | Enables open-action, catalog-action, name-tree, associated-file, and unreachable-object removal while preserving AcroForm and metadata |
TPdfObjectGraphInspectOptions.Default | Returns limits of 100000 objects, depth 32, 64 MiB output, 1 MiB strings, and enabled stream digests |
| Type | Description |
|---|---|
TPdfTreeKind | Selects a byte-sorted NameTree with ptkName or a signed 64-bit NumberTree with ptkNumber |
TPdfTreeObjectReference | Identifies one indirect tree node by ObjectNumber and Generation |
TPdfTreeEntry | Stores NameKey or NumberKey plus one normalized complete PDF object in RawValue; TPdfTreeEntries is its dynamic array |
TPdfTreeEditOptions | Bounds MaxEntries, MaxNodes, MaxDepth, MaxLeafEntries, and MaxKidsPerNode; Default supplies conservative production limits |
TPdfTreeValidationIssue | One issue carrying object evidence and diagnostic Message; TPdfTreeValidationIssues is its dynamic array |
TPdfTreeValidationIssueKind | Issue values ptviInvalidRoot, ptviUnreadableNode, ptviCycle, ptviDepthLimit, ptviNodeLimit, ptviEntryLimit, ptviInvalidNodeShape, ptviInvalidKey, ptviInvalidValue, ptviInvalidLimits, ptviDuplicateKey, ptviUnsortedKey, and ptviDeadlineExceeded |
TPdfTreeValidationReport | Reports NodeCount, EntryCount, MaximumDepth, Issues, object evidence, success state, and error text |
TPdfTreeSerializedObject | Contains one balanced node Reference with complete indirect-object Dictionary data, and reports whether the reference was reused; TPdfTreeSerializedObjects is its dynamic array |
TPdfTreeEditor | Mutable sorted tree model that preserves opaque PDF values and emits a balanced indirect hierarchy; the default Entries property exposes sorted values, Options the effective limits, and RootReference the loaded root node |
TPdfOutlineStyleFlag | Presentation values posItalic and posBold; TPdfOutlineStyle is their set |
TPdfOutlineObjectReference | Identifies a retained outline object by object number and generation |
TPdfOutlineItem | Stores stable identity Id, parent identity ParentId, Title, one-based destination PageNumber where zero denotes an unresolved target, exact DestinationSuffix, DestinationInAction storing the destination as a GoTo action instead of direct /Dest, IsOpen, style, HasColor, ColorRed, ColorGreen, ColorBlue, and the retained Reference of type TPdfOutlineObjectReference; TPdfOutlineItems is its dynamic array |
TPdfOutlineEditOptions | Bounds MaxItems and hierarchy depth, with conservative defaults supplied by Default |
TPdfOutlineValidationIssueKind | Issue values poviNone, poviInvalidCatalog, poviUnreadableItem, poviCycle, poviDepthLimit, poviItemLimit, poviInvalidParent, poviInvalidSibling, poviMissingTitle, poviInvalidDestination, poviInvalidPageMap, poviEncryptedInput, poviWriteFailure, and poviVerificationFailure |
TPdfOutlineValidationReport | Reports IssueKind, object evidence, ItemCount, MaximumDepth, RemappedDestinationCount, RemovedDanglingItemCount, success state, and error text |
TPdfOutlineEditor | Mutable depth-first outline model with verified page-plan remapping and incremental persistence; the default Items property exposes stable items, Options the effective limits, and RootReference the retained outline root |
TPdfGraftObjectReference | Identifies one source or destination indirect object by exact object number and generation |
TPdfGraftMapEntry | One stored mapping pairing a Source reference with its assigned Destination reference by exact object number and generation |
TPdfCrossDocumentGraftMap | Reusable source-identity-bound object map backed by TPdfGraftMapEntries that preserves cycles and shared references and rolls back entries added by a failed graft; the default Entries property reads stored mappings and SourceIdentity returns the identity bound at creation |
TPdfGraftPageMapping | Maps one-based SourcePageNumber to one-based DestinationPageNumber for widget /P and page /Annots updates; TPdfGraftPageMappings is its dynamic array |
TPdfAcroFormCollisionPolicy | Selects pagcpReject or pagcpRename when a source root field title collides with a destination root field title |
TPdfAcroFormGraftOptions | Controls CollisionPolicy, RenamePrefix, object and recursion budgets, and AllowSignedDestination |
TPdfAcroFormGraftReport | Reports SourceFieldCount, GraftedFieldCount, ReusedObjectCount, DestinationFieldCount, MappedPageCount, GraftedObjectCount, RenamedFieldCount, output size, success state, and error text |
TPdfVersionInfo | Version report with HeaderVersion, CatalogVersion, CoreVersion, AdobeBaseVersion, AdobeExtensionLevel, HasCatalogVersion, HasDeveloperExtensions, and HasAdobeExtension |
TPdfSparseRevisionInfo | Latest-revision snapshot with RootObjectNumber, RootGeneration, InfoObjectNumber, InfoGeneration, SizeValue, MaximumObjectNumber, PreviousXrefOffset, UsesXrefStream, HasEncrypt, HasDocumentId, HasTaggedStructure, FirstDocumentId, CatalogDictionary, and InfoDictionary |
TPdfSparseUpdateObject | One revision entry with ObjectNumber, Generation, and a complete Data body carrying N G obj ... endobj bytes |
TPdfSparseUpdateObjects | Dynamic array of TPdfSparseUpdateObject entries appended by AppendPdfSparseUpdate |
TPdfSparsePageDictionary | One active page object with ObjectNumber, Generation, and bounded Dictionary bytes |
TPdfSparsePageDictionaries | Dynamic array of active page dictionaries in page-tree order |
TPdfSparseDictionaryReader | Reusable owner of a sparse classic, xref-stream, hybrid, and object-stream index for repeated exact-generation dictionary lookup without source-sized allocation |
TPdfPruneReport | Reachability result with SourceByteCount, OutputByteCount, KeptObjectCount, PrunedObjectCount, Succeeded, and ErrorMessage |
TPdfResourcePruneReport | Resource-pruning result with ScannedScopeCount, UpdatedScopeCount, RemovedNameCount, RemovedObjectCount, stream counts, byte totals, success state, and error text |
TPdfDedupReport | Deduplication result with SourceByteCount, OutputByteCount, KeptObjectCount, PrunedObjectCount, MergedFontCount, MergedImageCount, MergedFormXObjectCount, MergedExtGStateCount, MergedColorSpaceCount, MergedShadingCount, MergedPatternCount, Succeeded, and ErrorMessage |
TPdfFlateRecompressOptions | Replacement thresholds MinSavingBytes and MinSavingRatio |
TPdfFlateRecompressReport | Recompression result with SourceByteCount, OutputByteCount, RecompressedCount, SkippedCount, FailedCount, OriginalStreamBytes, RecompressedStreamBytes, Succeeded, and ErrorMessage |
TPdfInlineImageExternaliseOptions | Contains SkipUnsafePages, which preserves pages whose inline-image boundaries cannot be resolved |
TPdfInlineImageExternaliseReport | Externalisation result with SourceByteCount, OutputByteCount, ExternalisedCount, SkippedPageCount, FailedCount, CreatedXObjectCount, Succeeded, and ErrorMessage |
TPdfReproducibleReport | Deterministic rewrite result with SourceByteCount, OutputByteCount, KeptObjectCount, PrunedObjectCount, StrippedTimestampCount, Succeeded, and ErrorMessage |
TPdfPageLabelStyle | Numbering styles plsNone, plsDecimal, plsUppercaseRoman, plsLowercaseRoman, plsUppercaseLetters, and plsLowercaseLetters |
TPdfPageLabelRange | One label range with zero-based StartPageIndex, Style, Prefix, and StartNumber |
TPdfPageLabelRanges | Dynamic array of TPdfPageLabelRange values |
TPdfPageLabelReport | Label rewrite result with SourceByteCount, OutputByteCount, AppliedRangeCount, ReplacedExistingLabels, Succeeded, and ErrorMessage |
TPdfOptionalContentUsage | Visibility contexts ocuView, ocuPrint, ocuExport, and ocuDesign |
TPdfOptionalContentState | Per-usage states ocsUnspecified, ocsOn, and ocsOff |
TPdfOptionalContentBaseState | Configuration base states ocbsOn, ocbsOff, and ocbsUnchanged |
TPdfOptionalContentMembershipPolicy | Membership policies ocmpAnyOn, ocmpAllOn, ocmpAnyOff, ocmpAllOff, and ocmpUnknown |
TPdfOptionalContentIntegerArray | Dynamic integer array used for optional-content object-number collections |
TPdfOptionalContentStringArray | Dynamic AnsiString array used for PDF name collections |
TPdfOptionalContentWideStringArray | Dynamic WideString array used for decoded optional-content text |
TPdfOptionalContentRadioGroup | One mutually exclusive group represented by GroupObjectNumbers |
TPdfOptionalContentRadioGroups | Dynamic array of TPdfOptionalContentRadioGroup values |
TPdfOptionalContentGroup | OCG record with ObjectNumber, Generation, Name, Intents, ViewState, PrintState, ExportState, PageElementSubtype, Language, LanguagePreferred, UserType, UserNames, HasZoomRange, MinimumZoom, MaximumZoom, EffectiveVisible, Locked, and RadioGroupIndex |
TPdfOptionalContentGroups | Dynamic array of TPdfOptionalContentGroup values |
TPdfOptionalContentConfiguration | Configuration record with ObjectNumber, Generation, Name, Creator, BaseState, Intents, OnGroupObjectNumbers, OffGroupObjectNumbers, LockedGroupObjectNumbers, OrderGroupObjectNumbers, RadioGroups, and HasAutomaticState |
TPdfOptionalContentConfigurations | Dynamic array of TPdfOptionalContentConfiguration values |
TPdfOptionalContentMembership | OCMD record with ObjectNumber, Generation, GroupObjectNumbers, Policy, VisibilityExpression, and EffectiveVisible |
TPdfOptionalContentMemberships | Dynamic array of TPdfOptionalContentMembership values |
TPdfOptionalContentInventory | Inspection result with Usage, SelectedConfigurationIndex, Groups, Configurations, Memberships, Succeeded, and ErrorMessage |
TPdfOptionalContentStateChange | Requested Visible state for one GroupObjectNumber |
TPdfOptionalContentStateChanges | Dynamic array of TPdfOptionalContentStateChange values |
TPdfOptionalContentConfigureOptions | Zero-based ConfigurationIndex selecting the optional-content configuration that receives the requested states, plus Usage, DisableAutomaticState, and EnforceRadioGroups controls |
TPdfOptionalContentConfigureReport | Configuration result with SourceByteCount, OutputByteCount, GroupCount, ChangedGroupCount, UpdatedUsageStateCount, SelectedConfigurationIndex, RemovedAutomaticState, Succeeded, and ErrorMessage |
TPdfOptionalContentCreateIntent, TPdfOptionalContentCreateGroup, and TPdfOptionalContentCreateGroups | Selects intent pociView or pociDesign and defines one created OCG with Name, Creator, Intent, InitialStateVisible, Locked, and RadioTag |
TPdfOptionalContentCreateExpressionOperator, TPdfOptionalContentCreateExpression, TPdfOptionalContentCreateExpressions, TPdfOptionalContentCreateMembership, and TPdfOptionalContentCreateMemberships | Builds one-level or multi-level nested visibility expressions (up to 32 levels) using poceAll (/And), poceAny (/Or), or poceNot (/Not) with Kind, GroupIndices and recursive Children, and defines created OCMDs with MemberGroupIndices, Policy, and Expression |
TPdfOptionalContentCreateForm, TPdfOptionalContentCreateForms, and TPdfOptionalContentCreateReport | Embeds OC-gated Form XObjects with GroupIndex, PageNumber, Content, BBoxLeft, BBoxBottom, BBoxRight, BBoxTop, HasMatrix, MatrixA, MatrixB, MatrixC, MatrixD, MatrixE, MatrixF, ResourceName, and InheritPageResources, and reports CreatedGroupObjectNumbers, CreatedMembershipObjectNumbers, AttachedFormCount, byte counts, and status |
TPdfShadingCreateType, TPdfShadingCreateColorSpace, TPdfShadingCreateNumbers, TPdfShadingCreateComponents, TPdfShadingCreateStop, and TPdfShadingCreateStops | Selects pstAxial or pstRadial shading in pscDeviceGray, pscDeviceRGB, pscDeviceCMYK, pscCalGray, pscCalRGB, pscLab, or pscICCBased color space, and defines color stops with Position and Color |
TPdfShadingCreatePageBox, TPdfShadingCreateBoxes, TPdfShadingCreateRect, TPdfShadingCreate, TPdfShadingCreateShadings, and TPdfShadingCreateReport | Defines page boxes (PageNumber, Left, Bottom, Right, Top), target rectangles (TPdfShadingCreateRect) and shadings (ShadingType, ColorSpace, Coords, StartColor, EndColor, Stops, HasMatrix, MatrixA, MatrixB, MatrixC, MatrixD, MatrixE, MatrixF, HasTargetRect, TargetRect, HasExtend, ExtendStart, ExtendEnd, Background, IccProfile, CalWhitePoint, CalGamma, LabRange, PageNumber, ResourceName), and reports CreatedShadingObjectNumbers, AttachedShadingCount, byte counts, and status |
TPdfSanitiseOptions | Independent StripOpenAction, StripCatalogActions, StripNames, StripAssociatedFiles, StripAcroForm, StripMetadata, and RemoveUnreachable controls |
TPdfSanitiseReport | Sanitisation result with SourceByteCount, OutputByteCount, StrippedEntryCount, PrunedObjectCount, nested PruneReport, Succeeded, and ErrorMessage |
TPdfObjectGraphInspectOptions | Bounds the JSON export with MaxObjects, MaxDepth, MaxOutputBytes, MaxStringBytes, and IncludeStreamDigests |
TPdfObjectGraphReport | Shared export and patch result with SourceByteCount, OutputByteCount, ObjectCount, ExportedObjectCount, PatchedObjectCount, AppliedOperationCount, Truncated, Succeeded, and ErrorMessage |
TPdfObjectPatchOperationKind | Patch actions popSet and popRemove |
TPdfObjectPatchValueKind | Value kinds povNull, povBoolean, povInteger, povReal, povName, povTextString, and povReference |
TPdfObjectPatchValue | Tagged value with Kind, BooleanValue, IntegerValue, RealValue, TextValue, ReferenceObjectNumber, and ReferenceGeneration |
TPdfObjectPatchOperation | One operation with Kind, ObjectNumber, Generation, Key, and Value |
TPdfObjectPatchOperations | Dynamic array of TPdfObjectPatchOperation values |
TPdfTreeEditor, TPdfOutlineEditor, and GraftPdfAcroForm reject encrypted input because their standalone serializers do not inherit document security parameters, and all source and destination streams must remain seekable during verified saveGraftPdfAcroForm rejects XFA, dangling references, unmapped widget pages, duplicate page mappings, and default-resource collisions; signed destinations require explicit authorizationTPdf methods expose explicit authorization where signed input can be acceptedPatchPdfObjectGraph refuses duplicate operations, missing objects, malformed or duplicate dictionary keys, protected stream filter and length keys, and missing reference targetsAppendPdfDirtyRevision requires matching baseline and previous-output catalog references and cannot encode an indirect object that was freedSanitiseActiveContentPdfStream workspace overload requires three distinct seekable streams when RemoveUnreachable=TrueTPdfOutlineEditor.SetUri, TPdfOutlineEditor.SetRemoteGoTo and TPdfOutlineEditor.SetLaunch replace a destination with a UTF-8 URI, remote GoTo (/GoToR) or launch (/Launch) action and safely encode literal delimiters; save verification ignores expanded state on leaf items because PDF omits their branch Count
The GraftPdfAcroForm options overload supports pagcpReject, pagcpRename, pagcpNamespace and compatible terminal text/choice/checkbox/radio joining with selected-widget pruning, isolated resources, appearances and calculation order; see FPdfFormMerge for policies and transactional document integration
Compatible matching compares used default-appearance fonts through bounded dependency fingerprints independent of object numbers, reuses confirmed font objects, and snapshots missing appearance resources from the original AcroForm defaults; checkbox/radio state constraints and repeated-page integration are documented in FPdfFormMerge
TPdfAcroFormGraftOptions.NamespacePrefix names the parent inserted by the namespace policy; TPdfAcroFormCollisionPolicy.pagcpMergeCompatible joins supported compatible terminal text, choice, checkbox or radio fields
TPdfAcroFormGraftReport.FilteredFieldCount and TPdfAcroFormGraftReport.FilteredWidgetCount count source entries removed by selected-page filtering; TPdfAcroFormGraftReport.ResourceRenameCount counts isolated default resource names and TPdfAcroFormGraftReport.MergedFieldCount counts compatible fields joined to an existing owner
CapturePdfNavigation and WritePdfNavigation capture and remap named destinations and page-link annotations, including symbolic name keys and chained /Next action sequences, using explicit owner-page mappings; see FPdfMerge for raw key semantics, destination parameters, limits and transactional integration
TPdfNavigationNamedDestination stores one captured name lookup: PageNumber is the absolute one-based target page where zero denotes an unresolved target, and DestinationSuffix carries the exact destination mode and parameters, including null values
TPdfNavigationNamedDestinations is the dynamic array of captured name lookups
TPdfNavigationPageLink locates one link annotation through its one-based owner PageNumber and zero-based AnnotationIndex and LinkIndex, and carries HasDestination, HasGotoAction, HasRemoteGotoAction, HasLaunchAction, HasNamedAction and HasUriAction flags together with the resolved local or remote page number, exact destination suffix, file specification (ActionFileSpec), standard named action name (NamedActionName) and URI (ActionUri)
Symbolic targets keep their original PDF string bytes: DestinationNameKey holds the named destination key a /Dest entry points at and ActionNameKey the key a named /GoTo action resolves, so merge remapping can rename keys consistently
HasChainedActions reports a /Next action sequence on the link; every TPdfNavigationLinkAction entry in NextActions captures one chained action with the same goto, remote goto, launch, named and URI fields, and TPdfNavigationLinkActions is the dynamic array of captured chained actions
TPdfNavigationPageLinks is the dynamic array of captured page links
TPdfNavigationNamedDestination= record
// Keep the original PDF string bytes, including a UTF-16 BOM when present
NameKey: AnsiString;
// Absolute one-based page number; zero denotes an unresolved target
PageNumber: Integer;
// Exact destination mode and parameters, including null values
DestinationSuffix: AnsiString;
end;
TPdfNavigationNamedDestinations= array of TPdfNavigationNamedDestination;
TPdfNavigationLinkAction= record
HasGotoAction: Boolean;
ActionPageNumber: Integer;
ActionSuffix, ActionNameKey: AnsiString;
HasRemoteGotoAction, HasLaunchAction, HasNamedAction, HasUriAction: Boolean;
ActionFileSpec, NamedActionName, ActionUri: AnsiString;
end;
TPdfNavigationLinkActions= array of TPdfNavigationLinkAction;
TPdfNavigationPageLink= record
// Owner page is one-based; annotation and link-only ordinals are zero-based
PageNumber, AnnotationIndex, LinkIndex: Integer;
HasDestination, HasGotoAction: Boolean;
DestinationPageNumber, ActionPageNumber: Integer;
DestinationSuffix, ActionSuffix: AnsiString;
DestinationNameKey, ActionNameKey: AnsiString;
HasRemoteGotoAction, HasLaunchAction, HasNamedAction, HasUriAction: Boolean;
ActionFileSpec, NamedActionName, ActionUri: AnsiString;
HasChainedActions: Boolean;
NextActions: TPdfNavigationLinkActions;
end;
TPdfNavigationPageLinks= array of TPdfNavigationPageLink;
ReadPdfActiveObjects returns the latest active object values with their exact generation numbers and the active catalog revision, resolving classic xref tables, xref streams, incremental revisions and compressed object-stream members
Body excludes the indirect-object header and endobj marker; ordinary streams retain their dictionary and encoded payload, while compressed members are materialized as ordinary values, and xref/object-stream infrastructure is excluded from the returned collection
The source position is restored and a failure returns an empty object collection with diagnostics; encrypted input is rejected, while signatures can be inspected without altering their bytes
Defaults allow 256 MiB of source bytes, 64 MiB per materialized body, 256 MiB of cumulative bodies, 64 MiB per decoded object stream, 256 MiB of cumulative decoded object-stream caches and 1,000,000 object-number slots
Body limits are checked before each body copy and count temporary infrastructure bodies as well as returned values; the independently named decoded-cache limits stop object-stream decoding before exceeding the caller's budget
These are logical buffer limits, not a process-wide memory cap: source copies, the direct-object staging stream, scan buffers, decoder working storage and object metadata consume additional bounded allocations, and scan buffers can duplicate retained bodies
TPdfActiveObject is one returned value with its ObjectNumber, exact Generation, and complete Body; TPdfActiveObjects is its dynamic array
TPdfActiveObjectReadOptions bounds the read with MaxSourceBytes for the whole source stream, MaxObjectBytes per materialized body, MaxTotalObjectBytes for cumulative bodies, MaxDecodedObjectStreamBytes per decoded object stream, and MaxTotalDecodedObjectStreamBytes for cumulative decoded object-stream caches, while MaxObjects bounds the active object count. Since v3.292.0, MaxObjectNumber independently sets an exclusive sparse object-number limit; its default zero retains the previous MaxObjects index bound. Both explicit limits must be positive and at most 4,000,000, with zero allowed only for the index override
type
TPdfActiveObject = record
ObjectNumber, Generation: Integer;
Body: TBytes;
end;
TPdfActiveObjects = array of TPdfActiveObject;
TPdfActiveObjectReadOptions = record
MaxSourceBytes, MaxObjectBytes, MaxTotalObjectBytes: Int64;
MaxDecodedObjectStreamBytes, MaxTotalDecodedObjectStreamBytes: Int64;
MaxObjects: Integer;
MaxObjectNumber: Integer;
class function Default: TPdfActiveObjectReadOptions; static;
end;
function ReadPdfActiveObjects(Source: TStream;
const Options: TPdfActiveObjectReadOptions; out Objects: TPdfActiveObjects;
out Revision: TPdfSparseRevisionInfo; out ErrorText: string): Boolean;
Since v3.315.0, streaming and compatibility sanitization propagate failed pruning rather than marking the result successful; fallback stream/in-memory document-ID arithmetic uses explicit 32-bit modular addition, preserving normal identifier bytes under checked Free Pascal builds