PDFium Delphi Component Docs

SaveAsObjectGraphPatched method

Component: TPdf  ·  Unit: PDFium
Save the document with direct edits applied to named entries of indirect objects

Syntax

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

StreamTStream. Destination stream
OperationsTPdfObjectPatchOperations. Array of operations, each naming a Kind (popSet or popRemove), the target ObjectNumber and Generation, the dictionary Key, and for popSet a Value whose own Kind selects null, boolean, integer, real, name, text string, or reference
ReportTPdfObjectGraphReport. Receives PatchedObjectCount, AppliedOperationCount, byte counts, Succeeded, and ErrorMessage
AllowSignedDocumentBoolean. Permit rewriting a signed document. Defaults to False
ResultBoolean. True when the patched document was written

 

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

FileNamestring. Destination file, written atomically through a temporary file in the same directory
OperationsTPdfObjectPatchOperations. Same operation list as the stream overload
ReportTPdfObjectGraphReport. Same report record
AllowSignedDocumentBoolean. Permit rewriting a signed document
ResultBoolean. True when the file was written

Description

Reaches entries that no typed API exposes - a private key in a catalogue dictionary, a viewer preference which PDFium does not model, a corrected entry in a damaged file - by naming the object and the key directly

AppliedOperationCount against the length of Operations shows whether every edit found its target; an operation naming an object which does not exist is reported rather than silently ignored

Rewriting a signed document invalidates its signatures, so that case is refused unless the caller opts in. Use ExportObjectGraph first to find the object numbers to patch

See Also

ExportObjectGraph, SaveAs, SaveAsRepaired