import { PdfDictionary } from '../core/objects/pdf-dictionary.js'; import { PdfIndirectObject } from '../core/objects/pdf-indirect-object.js'; import { PdfObject } from '../core/objects/pdf-object.js'; import { PdfTrailerEntries } from '../core/objects/pdf-trailer.js'; import { PdfToken } from '../core/tokens/token.js'; import { PdfComment } from '../index.js'; import { PdfXrefLookup } from './pdf-xref-lookup.js'; /** * Represents a single revision of a PDF document. * PDF documents can have multiple revisions for incremental updates, * where each revision contains its own set of objects and cross-reference table. */ export declare class PdfRevision extends PdfObject { /** Objects contained in this revision (private backing field) */ private _objects; /** Whether this revision is locked (private backing field) */ private _locked; /** Cross-reference lookup table for this revision */ xref: PdfXrefLookup; /** * Creates a new PDF revision. * * @param options - Configuration options for the revision * @param options.objects - Initial objects for this revision * @param options.prev - Previous revision or xref lookup to link to * @param options.locked - Whether the revision should be locked initially */ constructor(options?: { objects?: PdfObject[]; prev?: PdfXrefLookup | PdfRevision; locked?: boolean; }); get header(): PdfComment | undefined; set header(comment: PdfComment); /** * Gets whether this revision is locked (cannot be modified). */ get locked(): boolean; /** * Sets whether this revision is locked. * When locking, creates a cached clone of all objects to freeze their state. * When unlocking, clears the cache. */ set locked(value: boolean); /** * Gets the objects in this revision. * Returns fresh clones of cached objects if the revision is locked, otherwise returns live objects. * Each access to a locked revision's objects returns new clones to prevent mutations. */ get objects(): ReadonlyArray; /** * Sets the objects array. * @throws Error if the revision is locked */ set objects(value: PdfObject[]); get indirectObjects(): PdfIndirectObject[]; /** * Links this revision to a previous revision's cross-reference table. * * @param xref - The previous revision's xref lookup or revision */ setPrev(xref: PdfXrefLookup | PdfRevision): void; /** * Checks if an object reference exists in this revision. * * @param object - The object to check for * @returns True if the exact object instance exists in this revision */ contains(object: PdfObject): boolean; /** * Checks if an equivalent object exists in this revision (by value equality). * * @param object - The object to check for * @returns True if an equal object exists in this revision */ exists(object: PdfObject): boolean; /** * Adds objects to the beginning of the revision's object list. * * @param objects - Objects to add at the beginning * @throws Error if the revision is locked */ unshift(...objects: PdfObject[]): void; /** * Adds objects to the revision. * * @param objects - Objects to add to the revision * @throws Error if the revision is locked */ addObject(...objects: PdfObject[]): void; /** * Adds an object at a specific position in the revision. * * @param object - The object to add * @param index - Position to insert at (number) or object to insert before * @throws Error if the revision is locked or index is out of bounds */ addObjectAt(object: PdfObject, index?: number | PdfObject): void; /** * Removes objects from the revision. * * @param objects - Objects to remove from the revision * @throws Error if the revision is locked */ deleteObject(...objects: PdfObject[]): void; isModified(): boolean; /** * Updates the revision by sorting objects and updating the xref table. */ update(): void; /** * Sorts objects by their insertion order. * Indirect objects are placed before other objects. */ sortObjects(): void; /** * Gets the trailer dictionary for this revision. * * @returns The trailer dictionary containing document metadata references */ get trailerDict(): PdfDictionary; /** * Creates a deep copy of this revision. * * @returns A cloned PdfRevision instance */ toJSON(): { type: string; objects: object[]; }; cloneImpl(): this; protected tokenize(): PdfToken[]; isEmpty(): boolean; }