PDFium Delphi Component Docs

בדיקת גרף אובייקטים ותיקון

Component: TPdf  ·  Units: PDFium, FPdfCompress
מייצאת תצוגה מוקלדת מוגבלת של אובייקטים עקיפים פעילים ומחילה תיקוני מילון מוגבלים טרנזקציונלית

Syntax

function ExportObjectGraph(Stream: TStream; const Options: TPdfObjectGraphInspectOptions; out Report: TPdfObjectGraphReport): Boolean;

function SaveAsObjectGraphPatched(Stream: TStream; const Operations: TPdfObjectPatchOperations; out Report: TPdfObjectGraphReport; AllowSignedDocument: Boolean = False): Boolean;

function SaveAsObjectGraphPatched(const FileName: string; const Operations: TPdfObjectPatchOperations; out Report: TPdfObjectGraphReport; AllowSignedDocument: Boolean = False): Boolean;

Typed JSON format

The root object, active object count, exported objects, and truncation state are emitted in the versioned pdf-object-graph-v1 envelope

Each value is identified as a dictionary, array, literal or hexadecimal string, name, reference, null, Boolean, integer, real, or keyword

Streams expose their encoded byte count and, when enabled, a SHA-256 digest while their payload remains omitted

Direct objects and members materialized from ObjStm containers use the same representation

Inspection options

MaxObjectsMaximum active objects written before the JSON envelope reports truncated: true
MaxDepthMaximum nested array and dictionary depth from 1 through 32
MaxOutputBytesHard upper bound for the complete UTF-8-compatible JSON byte stream
MaxStringBytesMaximum bytes retained from one PDF string or name
IncludeStreamDigestsCalculates SHA-256 over encoded stream bytes without decoding or exporting the payload

Patch model

Every TPdfObjectPatchOperation selects an exact object number, generation, and top-level dictionary key, then either sets or removes that key

Set operations accept typed null, Boolean, integer, real, name, text string, or indirect reference values and never accept raw PDF syntax

All object identities, generations, references, names, duplicate operations, and target dictionaries are validated before output is delivered

Stream length and filter-chain keys cannot be patched because changing them independently from encoded bytes would corrupt the stream

The writer appends one incremental revision, reconstructs the resulting active graph, strict-loads it through PDFium, and only then writes the caller stream or atomically replaces a file

Policies and limits

Example

Options := TPdfObjectGraphInspectOptions.Default;
Pdf.ExportObjectGraph(JsonStream, Options, Report);
SetLength(Operations, 1);
Operations[0].Kind := popSet;
Operations[0].ObjectNumber := CatalogObjectNumber;
Operations[0].Generation := 0;
Operations[0].Key := 'Lang';
Operations[0].Value.Kind := povTextString;
Operations[0].Value.TextValue := 'en-US';
Pdf.SaveAsObjectGraphPatched('patched.pdf', Operations, Report);

See Also

Incremental save session, SaveAsObjectStream, SaveAs