inherits from Exception
(no public members)
(no public members)
fixed-width patchable slots (/ByteRange)
tPdfObject
One PDF value. All values live in the arena of their tPdfDocument (the document frees every object it created), so values can be shared and mutated freely without ownership bookkeeping. Loaded top-level indirect objects carry their object number/generation in ObjNumber/ObjGeneration (-1 for direct values), which is what the incremental writer needs to re-emit an updated object under its original number.
constructor Create(aDocument: tPdfDocument; aKind: tPdfObjectKind);
property Kind: tPdfObjectKind read fKind;
property BoolValue: Boolean read fBoolValue write fBoolValue;
property IntValue: Int64 read fIntValue write fIntValue;
property RealValue: Double read fRealValue write fRealValue;
property StrValue: OctetString read fStrValue write fStrValue;
property HexString: Boolean read fHexString write fHexString;
property RefNumber: Integer read fRefNumber write fRefNumber;
property RefGeneration: Integer read fRefGeneration write fRefGeneration;
property ObjNumber: Integer read fObjNumber write fObjNumber;
property ObjGeneration: Integer read fObjGeneration write fObjGeneration;
property Document: tPdfDocument read fDocument;
inherits from tPdfObject
tPdfArray - pokArray; items are arena objects.
constructor Create(aDocument: tPdfDocument);
destructor Destroy; override;
procedure Add(aValue: tPdfObject);
property Count: Integer read get_Count;
property Items[aIndex: Integer]: tPdfObject read get_Items; default;
inherits from tPdfObject
tPdfDictionary - pokDictionary. Keys are decoded name strings.
constructor Create(aDocument: tPdfDocument);
destructor Destroy; override;
function GetValue(const aKey: string): tPdfObject;
function Get(const aKey: string): tPdfObject;
function GetInt(const aKey: string; aDefault: Int64): Int64;
function GetName(const aKey: string): string;
function GetDictionary(const aKey: string): tPdfDictionary;
function GetArray(const aKey: string): tPdfArray;
procedure SetValue(const aKey: string; aValue: tPdfObject);
procedure SetInteger(const aKey: string; aValue: Int64);
procedure SetName(const aKey, aName: string);
procedure SetString(const aKey: string; const aValue: OctetString; aHex: Boolean = False);
procedure SetReference(const aKey: string; aNumber, aGeneration: Integer);
procedure RemoveKey(const aKey: string);
function HasKey(const aKey: string): Boolean;
property Count: Integer read get_Count;
property KeyName[aIndex: Integer]: string read get_KeyName;
property ValueByIndex[aIndex: Integer]: tPdfObject read get_ValueByIndex;
inherits from tPdfDictionary
tPdfStream - pokStream: a dictionary plus raw (still encoded) data. DecodedData applies FlateDecode (+ PNG predictors) on demand.
constructor Create(aDocument: tPdfDocument);
property Data: OctetString read fData write fData;
function DecodedData: OctetString;
tPdfXrefEntry - one cross-reference entry, all three ISO 32000 types.
fEntryType: Byte;
fOffset: Int64;
fGeneration: Integer;
fPresent: Boolean;
tPdfDocument
Loads a PDF from a stream or octet string, exposes the trailer, the cross-reference map and on-demand object loading (including objects inside object streams), plus factories for building new values in the document arena. The full file stays in Buffer - the signer needs the original bytes for ByteRange digesting anyway.
constructor Create;
destructor Destroy; override;
procedure LoadFromStream(aStream: TStream);
procedure LoadFromOS(const aData: OctetString);
function GetObject(aNumber: Integer): tPdfObject;
function Resolve(aValue: tPdfObject): tPdfObject;
function ResolveDictionary(aValue: tPdfObject): tPdfDictionary;
function Root: tPdfDictionary;
function FirstPage: tPdfDictionary;
function IsEncrypted: Boolean;
function MaxObjectNumber: Integer;
function ObjectLocation(aNumber: Integer; out aType: Byte; out aOffset: Int64; out aGeneration: Integer): Boolean;
function NewNull: tPdfObject;
function NewBoolean(aValue: Boolean): tPdfObject;
function NewInteger(aValue: Int64): tPdfObject;
function NewReal(aValue: Double): tPdfObject;
function NewString(const aValue: OctetString; aHex: Boolean = False): tPdfObject;
function NewName(const aName: string): tPdfObject;
function NewRaw(const aBytes: OctetString): tPdfObject;
function NewReference(aNumber, aGeneration: Integer): tPdfObject;
function NewArray: tPdfArray;
function NewDictionary: tPdfDictionary;
function NewStreamObject: tPdfStream;
property Buffer: OctetString read fBuffer;
property Trailer: tPdfDictionary read fTrailer;
property StartXref: Int64 read fStartXref;
property XrefIsStream: Boolean read fXrefIsStream;
property Version: string read fVersion;
tPdfEmittedObject - where one object body landed inside the emitted increment (offsets relative to the increment start).
fNumber: Integer;
fGeneration: Integer;
fOffset: Int64;
fLength: Int64;
tPdfIncrementalUpdate
Collects new objects (AddObject assigns the next free number) and updated existing objects (ReplaceObject re-emits under the original number), then Emit produces the complete byte suffix to append to the original file: object bodies, the cross-reference section (classic or stream, matching the original file's form), trailer with /Prev = the previous startxref, startxref and %%EOF. Emitted object positions are reported so a caller can patch fixed-width placeholders (the signature workflow).
constructor Create(aDocument: tPdfDocument);
function AddObject(aObj: tPdfObject): Integer;
procedure ReplaceObject(aObj: tPdfObject);
function Emit(aBaseLength: Int64): OctetString;
function EmittedCount: Integer;
function EmittedObject(aIndex: Integer): tPdfEmittedObject;