PDFium Delphi Component Docs

FPdfCompress unit

Unit: FPdfCompress
Stream-level PDF rewriting, compression, content normalization, optional-content configuration, sanitisation, object-graph access, incremental revisions, and version inspection used by the TPdf save pipeline

Description

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

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

Syntax

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(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);
  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);
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;

Functions and procedures

CallableDescription
TPdfTreeEditor.TryLoadLoads and validates one indirect NameTree or NumberTree through sparse exact-generation lookup, returning structural evidence without raising for malformed input
TPdfTreeEditor.LoadLoads one tree and raises an exception with the validation error when the structure is not safe to edit
TPdfTreeEditor.UpsertName and UpsertNumberInsert or replace one sorted entry while preserving its complete raw PDF value, including indirect references and compound objects
TPdfTreeEditor.RemoveName, RemoveNumber, and ClearRemove selected entries or empty the tree before deterministic rebalancing
TPdfTreeEditor.ValidateChecks key ordering, duplicate keys, raw values, entry limits, and current editor invariants
TPdfTreeEditor.BuildBalancedObjectsBuilds bounded leaf and internal nodes with exact /Limits, retains the root identity, and reuses compatible loaded indirect node references where possible
TPdfTreeEditor.SaveIncrementalAppends the balanced objects as a verified incremental revision and independently reloads the result before reporting success
TPdfOutlineEditor.TryLoad and LoadRead 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 MoveEdit complete outline subtrees by stable item identifiers while maintaining depth-first sibling order
TPdfOutlineEditor.SetTitle, SetStyle, SetExpanded, SetColor, and ClearColorUpdate visible outline presentation without discarding unrecognised item dictionary entries
TPdfOutlineEditor.RetargetAssigns a one-based explicit page destination as direct /Dest data or a GoTo action with a validated destination suffix
TPdfOutlineEditor.ApplyPageMapConsumes the one-based destination mapping produced by page-plan validation, updates surviving explicit destinations, and either removes dangling subtrees or reports them
TPdfOutlineEditor.SaveIncrementalRebuilds root, parent, sibling, child, count, style, colour, and destination entries, appends an incremental revision, and independently reloads the semantic result before success
TPdfCrossDocumentGraftMap.CreateBinds reusable source-to-destination indirect-object mappings to one caller-supplied source identity
TPdfCrossDocumentGraftMap.Add and TryResolveStore and resolve exact object-number and generation pairs, accept identical repeats, and reject conflicting destinations
GraftPdfAcroFormImports 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
CompressPdfStreamFlate-compresses eligible uncompressed streams and rebuilds the serialized PDF structure
LinearizePdfStreamReorders and renumbers the active object graph into linearized PDF layout with first-page and shared-object hint data
PackPdfObjectStreamsPacks eligible non-stream objects into bounded ObjStm groups and writes a cross-reference stream; both grouping limits must be positive
NormalizePdfDocumentContentNormalizes every page content sequence with TPdfContentNormalizeOptions and returns a document-level TPdfContentNormalizeReport
PruneUnreachablePdfStreamRewrites only objects reachable from the catalog into one classic revision while preserving surviving object numbers and generations
PruneUnusedPdfResourcesScans 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
DeduplicateResourcesPdfStreamPrunes unreachable objects and merges byte-identical font, image, and form XObject subgraphs
RecompressFlatePdfStreamDecodes and recompresses reachable FlateDecode streams when both requested saving thresholds are met
ExternaliseInlineImagesPdfStreamMoves inline image blocks into image XObjects, updates page resources, and rewrites affected content streams
ReproduciblePdfStreamProduces deterministic single-revision output by pruning unreachable objects, removing Info timestamps, and omitting the source /ID
AppendPdfDirtyRevisionCompares baseline and current semantic snapshots, appends changed or new indirect objects to the previous output, and reports appended counts
AppendEncryptedPdfDirtyRevisionAppends changed or new indirect objects under the inherited encryption context and validates or renews revision authentication
ApplyDefaultOpenActionInjects 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
PageLabelledPdfStreamWrites 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
InspectOptionalContentPdfStreamReads optional-content groups, configurations, memberships, usage metadata, and effective visibility into an inventory
ConfigureOptionalContentPdfStreamApplies requested group visibility to a selected configuration and writes the required optional-content updates
SanitiseActiveContentPdfStreamStrips 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
ExportPdfObjectGraphSerializes bounded indirect-object data as pdf-object-graph-v1 JSON with optional encoded-stream SHA-256 digests
PatchPdfObjectGraphSets or removes top-level dictionary entries by object identity and appends a verified incremental revision
PostProcessSavedPdfRuns 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
RepairSubsetToUnicodeCMapsRewrites 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
ReadPdfVersionInfoReads header, catalog override, effective core version, and Adobe developer-extension information
ReadPdfSparseRevisionInfoReads bounded latest-revision facts, catalog bytes, object generations, xref style, encryption state, document identifiers, and tagged-structure evidence through the sparse object index
ComposePdfSparseUpdateIdFormats an incremental trailer /ID by preserving caller or source identifiers and deriving missing values through a bounded streaming digest
ReadPdfSparseCatalogSubDictReads a direct or indirect catalog sub-dictionary, such as MarkInfo or ViewerPreferences, through the sparse object index
ReadPdfSparsePageDictionariesTraverses the active page tree through sparse classic, xref-stream, hybrid, and object-stream lookup and returns page dictionaries in page order
TPdfSparseDictionaryReader.CreateBuilds 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.DestroyReleases the retained index buffers without freeing the caller-owned source stream
TPdfSparseDictionaryReader.ReadDictionaryResolves one exact object number and generation through the retained index and returns bounded active dictionary bytes
TPdfSparseDictionaryReader.ReadLatestDictionaryResolves the active xref entry for an object number, returns its generation, and reads its dictionary through the retained index
TPdfSparseDictionaryReader.ReadDecodedStreamReads and decodes one direct unfiltered or single FlateDecode stream while enforcing MaximumDecodedBytes
TPdfOptionalContentConfigureOptions.DefaultSelects configuration 0 and View usage, removes automatic-state rules, and enforces radio groups
TPdfSanitiseOptions.DefaultEnables open-action, catalog-action, name-tree, associated-file, and unreachable-object removal while preserving AcroForm and metadata
TPdfObjectGraphInspectOptions.DefaultReturns limits of 100000 objects, depth 32, 64 MiB output, 1 MiB strings, and enabled stream digests

Types

TypeDescription
TPdfTreeKindSelects a byte-sorted NameTree with ptkName or a signed 64-bit NumberTree with ptkNumber
TPdfTreeObjectReferenceIdentifies one indirect tree node by ObjectNumber and Generation
TPdfTreeEntryStores NameKey or NumberKey plus one normalized complete PDF object in RawValue; TPdfTreeEntries is its dynamic array
TPdfTreeEditOptionsBounds MaxEntries, MaxNodes, MaxDepth, MaxLeafEntries, and MaxKidsPerNode; Default supplies conservative production limits
TPdfTreeValidationIssueOne issue carrying object evidence and diagnostic Message; TPdfTreeValidationIssues is its dynamic array
TPdfTreeValidationIssueKindIssue values ptviInvalidRoot, ptviUnreadableNode, ptviCycle, ptviDepthLimit, ptviNodeLimit, ptviEntryLimit, ptviInvalidNodeShape, ptviInvalidKey, ptviInvalidValue, ptviInvalidLimits, ptviDuplicateKey, ptviUnsortedKey, and ptviDeadlineExceeded
TPdfTreeValidationReportReports NodeCount, EntryCount, MaximumDepth, Issues, object evidence, success state, and error text
TPdfTreeSerializedObjectContains one balanced node reference, complete indirect-object data, and whether the reference was reused
TPdfTreeEditorMutable sorted tree model that preserves opaque PDF values and emits a balanced indirect hierarchy
TPdfOutlineStyleFlagPresentation values posItalic and posBold; TPdfOutlineStyle is their set
TPdfOutlineObjectReferenceIdentifies a retained outline object by object number and generation
TPdfOutlineItemStores stable identity, parent identity, title, explicit destination, action form, IsOpen, style, HasColor, ColorRed, ColorGreen, ColorBlue, and retained object reference; TPdfOutlineItems is its dynamic array
TPdfOutlineEditOptionsBounds MaxItems and hierarchy depth, with conservative defaults supplied by Default
TPdfOutlineValidationIssueKindIssue values poviNone, poviInvalidCatalog, poviUnreadableItem, poviCycle, poviDepthLimit, poviItemLimit, poviInvalidParent, poviInvalidSibling, poviMissingTitle, poviInvalidDestination, poviInvalidPageMap, poviEncryptedInput, poviWriteFailure, and poviVerificationFailure
TPdfOutlineValidationReportReports IssueKind, object evidence, ItemCount, MaximumDepth, RemappedDestinationCount, RemovedDanglingItemCount, success state, and error text
TPdfOutlineEditorMutable depth-first outline model with verified page-plan remapping and incremental persistence
TPdfGraftObjectReferenceIdentifies one source or destination indirect object by exact object number and generation
TPdfCrossDocumentGraftMapReusable source-identity-bound object map backed by TPdfGraftMapEntries that preserves cycles and shared references and rolls back entries added by a failed graft
TPdfGraftPageMappingMaps one-based SourcePageNumber to one-based DestinationPageNumber for widget /P and page /Annots updates
TPdfAcroFormCollisionPolicySelects pagcpReject or pagcpRename when a source root field title collides with a destination root field title
TPdfAcroFormGraftOptionsControls CollisionPolicy, RenamePrefix, object and recursion budgets, and AllowSignedDestination
TPdfAcroFormGraftReportReports SourceFieldCount, GraftedFieldCount, ReusedObjectCount, DestinationFieldCount, MappedPageCount, GraftedObjectCount, RenamedFieldCount, output size, success state, and error text
TPdfVersionInfoVersion report with HeaderVersion, CatalogVersion, CoreVersion, AdobeBaseVersion, AdobeExtensionLevel, HasCatalogVersion, HasDeveloperExtensions, and HasAdobeExtension
TPdfSparseRevisionInfoLatest-revision snapshot with RootObjectNumber, RootGeneration, InfoObjectNumber, InfoGeneration, SizeValue, MaximumObjectNumber, PreviousXrefOffset, UsesXrefStream, HasEncrypt, HasDocumentId, HasTaggedStructure, FirstDocumentId, CatalogDictionary, and InfoDictionary
TPdfSparseUpdateObjectOne revision entry with ObjectNumber, Generation, and a complete Data body carrying N G obj ... endobj bytes
TPdfSparseUpdateObjectsDynamic array of TPdfSparseUpdateObject entries appended by AppendPdfSparseUpdate
TPdfSparsePageDictionaryOne active page object with ObjectNumber, Generation, and bounded Dictionary bytes
TPdfSparsePageDictionariesDynamic array of active page dictionaries in page-tree order
TPdfSparseDictionaryReaderReusable owner of a sparse classic, xref-stream, hybrid, and object-stream index for repeated exact-generation dictionary lookup without source-sized allocation
TPdfPruneReportReachability result with SourceByteCount, OutputByteCount, KeptObjectCount, PrunedObjectCount, Succeeded, and ErrorMessage
TPdfResourcePruneReportResource-pruning result with ScannedScopeCount, UpdatedScopeCount, RemovedNameCount, RemovedObjectCount, stream counts, byte totals, success state, and error text
TPdfDedupReportDeduplication result with SourceByteCount, OutputByteCount, KeptObjectCount, PrunedObjectCount, MergedFontCount, MergedImageCount, MergedFormXObjectCount, Succeeded, and ErrorMessage
TPdfFlateRecompressOptionsReplacement thresholds MinSavingBytes and MinSavingRatio
TPdfFlateRecompressReportRecompression result with SourceByteCount, OutputByteCount, RecompressedCount, SkippedCount, FailedCount, OriginalStreamBytes, RecompressedStreamBytes, Succeeded, and ErrorMessage
TPdfInlineImageExternaliseOptionsContains SkipUnsafePages, which preserves pages whose inline-image boundaries cannot be resolved
TPdfInlineImageExternaliseReportExternalisation result with SourceByteCount, OutputByteCount, ExternalisedCount, SkippedPageCount, FailedCount, CreatedXObjectCount, Succeeded, and ErrorMessage
TPdfReproducibleReportDeterministic rewrite result with SourceByteCount, OutputByteCount, KeptObjectCount, PrunedObjectCount, StrippedTimestampCount, Succeeded, and ErrorMessage
TPdfPageLabelStyleNumbering styles plsNone, plsDecimal, plsUppercaseRoman, plsLowercaseRoman, plsUppercaseLetters, and plsLowercaseLetters
TPdfPageLabelRangeOne label range with zero-based StartPageIndex, Style, Prefix, and StartNumber
TPdfPageLabelRangesDynamic array of TPdfPageLabelRange values
TPdfPageLabelReportLabel rewrite result with SourceByteCount, OutputByteCount, AppliedRangeCount, ReplacedExistingLabels, Succeeded, and ErrorMessage
TPdfOptionalContentUsageVisibility contexts ocuView, ocuPrint, ocuExport, and ocuDesign
TPdfOptionalContentStatePer-usage states ocsUnspecified, ocsOn, and ocsOff
TPdfOptionalContentBaseStateConfiguration base states ocbsOn, ocbsOff, and ocbsUnchanged
TPdfOptionalContentMembershipPolicyMembership policies ocmpAnyOn, ocmpAllOn, ocmpAnyOff, ocmpAllOff, and ocmpUnknown
TPdfOptionalContentIntegerArrayDynamic integer array used for optional-content object-number collections
TPdfOptionalContentStringArrayDynamic AnsiString array used for PDF name collections
TPdfOptionalContentWideStringArrayDynamic WideString array used for decoded optional-content text
TPdfOptionalContentRadioGroupOne mutually exclusive group represented by GroupObjectNumbers
TPdfOptionalContentRadioGroupsDynamic array of TPdfOptionalContentRadioGroup values
TPdfOptionalContentGroupOCG record with ObjectNumber, Generation, Name, Intents, ViewState, PrintState, ExportState, PageElementSubtype, Language, LanguagePreferred, UserType, UserNames, HasZoomRange, MinimumZoom, MaximumZoom, EffectiveVisible, Locked, and RadioGroupIndex
TPdfOptionalContentGroupsDynamic array of TPdfOptionalContentGroup values
TPdfOptionalContentConfigurationConfiguration record with ObjectNumber, Generation, Name, Creator, BaseState, Intents, OnGroupObjectNumbers, OffGroupObjectNumbers, LockedGroupObjectNumbers, OrderGroupObjectNumbers, RadioGroups, and HasAutomaticState
TPdfOptionalContentConfigurationsDynamic array of TPdfOptionalContentConfiguration values
TPdfOptionalContentMembershipOCMD record with ObjectNumber, Generation, GroupObjectNumbers, Policy, VisibilityExpression, and EffectiveVisible
TPdfOptionalContentMembershipsDynamic array of TPdfOptionalContentMembership values
TPdfOptionalContentInventoryInspection result with Usage, SelectedConfigurationIndex, Groups, Configurations, Memberships, Succeeded, and ErrorMessage
TPdfOptionalContentStateChangeRequested Visible state for one GroupObjectNumber
TPdfOptionalContentStateChangesDynamic array of TPdfOptionalContentStateChange values
TPdfOptionalContentConfigureOptionsSelected configuration and usage plus DisableAutomaticState and EnforceRadioGroups controls
TPdfOptionalContentConfigureReportConfiguration result with SourceByteCount, OutputByteCount, GroupCount, ChangedGroupCount, UpdatedUsageStateCount, SelectedConfigurationIndex, RemovedAutomaticState, Succeeded, and ErrorMessage
TPdfSanitiseOptionsIndependent StripOpenAction, StripCatalogActions, StripNames, StripAssociatedFiles, StripAcroForm, StripMetadata, and RemoveUnreachable controls
TPdfSanitiseReportSanitisation result with SourceByteCount, OutputByteCount, StrippedEntryCount, PrunedObjectCount, nested PruneReport, Succeeded, and ErrorMessage
TPdfObjectGraphInspectOptionsBounds the JSON export with MaxObjects, MaxDepth, MaxOutputBytes, MaxStringBytes, and IncludeStreamDigests
TPdfObjectGraphReportShared export and patch result with SourceByteCount, OutputByteCount, ObjectCount, ExportedObjectCount, PatchedObjectCount, AppliedOperationCount, Truncated, Succeeded, and ErrorMessage
TPdfObjectPatchOperationKindPatch actions popSet and popRemove
TPdfObjectPatchValueKindValue kinds povNull, povBoolean, povInteger, povReal, povName, povTextString, and povReference
TPdfObjectPatchValueTagged value with Kind, BooleanValue, IntegerValue, RealValue, TextValue, ReferenceObjectNumber, and ReferenceGeneration
TPdfObjectPatchOperationOne operation with Kind, ObjectNumber, Generation, Key, and Value
TPdfObjectPatchOperationsDynamic array of TPdfObjectPatchOperation values

Safety and limits

TPdfOutlineEditor.SetUri replaces a destination with a UTF-8 URI action and safely encodes 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 joining with selected-widget pruning, isolated resources, appearances and calculation order; see FPdfFormMerge for policies and transactional document integration

AcroForm collision reports

TPdfAcroFormGraftOptions.NamespacePrefix names the parent inserted by the namespace policy; TPdfAcroFormCollisionPolicy.pagcpMergeCompatible joins supported compatible terminal text or choice 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 using explicit owner-page mappings; see FPdfMerge for raw key semantics, destination parameters, limits and transactional integration

Navigation capture records

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;
  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;
  end;
  TPdfNavigationPageLinks= array of TPdfNavigationPageLink;

Read active object values

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

type
  TPdfActiveObject = record
    ObjectNumber, Generation: Integer;
    Body: TBytes;
  end;
  TPdfActiveObjects = array of TPdfActiveObject;
  TPdfActiveObjectReadOptions = record
    MaxSourceBytes, MaxObjectBytes, MaxTotalObjectBytes: Int64;
    MaxDecodedObjectStreamBytes, MaxTotalDecodedObjectStreamBytes: Int64;
    MaxObjects: Integer;
    class function Default: TPdfActiveObjectReadOptions; static;
  end;

function ReadPdfActiveObjects(Source: TStream;
  const Options: TPdfActiveObjectReadOptions; out Objects: TPdfActiveObjects;
  out Revision: TPdfSparseRevisionInfo; out ErrorText: string): Boolean;

See Also

FPdfContentNormalize, TPdf.SaveAs, TPdf.SaveAsNormalizedContent, TPdf.InspectOptionalContent, TPdf.ObjectGraph, ReadPdfVersionInfo