import { ByteArray } from '../../types.js'; import { PdfToken } from '../tokens/token.js'; export declare abstract class PdfObject { /** Optional tokens to prepend or append during serialization */ preTokens?: PdfToken[]; /** Optional tokens to prepend or append during serialization */ postTokens?: PdfToken[]; /** Indicates whether the object has been modified. By default, assume it has been modified because it's a new object */ protected modified: boolean; /** Indicates whether the object is immutable (cannot be modified) */ protected immutable: boolean; /** Tokenizes the object into an array of PdfTokens */ protected abstract tokenize(): PdfToken[]; /** Cached byte representation of the object, if available */ protected cachedTokens?: PdfToken[]; /** The type of this PDF object */ get objectType(): string; /** * Returns true if this object's serialized form ends with a self-delimiting * character (e.g., `)`, `>`, `]`, `>>`). Such objects do not require trailing * whitespace before the next token. */ get isTrailingDelimited(): boolean; /** Indicates whether the object has been modified. Override this method if the modified state is determined differently */ isModified(): boolean; /** Sets the modified state of the object. Override this method if the modified state is determined differently */ setModified(modified?: boolean): void; /** Indicates whether the object is immutable (cannot be modified) */ isImmutable(): boolean; /** Sets the immutable state of the object */ setImmutable(immutable?: boolean): void; /** Converts the object to an array of PdfTokens, including any pre or post tokens */ toTokens(): PdfToken[]; /** Converts the object to a ByteArray, optionally padding to a specified length */ toBytes(padTo?: number): ByteArray; /** Converts the object to a string representation */ toString(): string; /** Attempts to cast the object to a specific PdfObject subclass */ as(ctor: new (...args: any[]) => T): T; /** Creates a deep clone of the object. Override this method in subclasses to ensure all properties are cloned correctly */ protected abstract cloneImpl(): this; /** Creates a deep clone of the object */ clone(): this; /** Compares this object to another for equality based on their token representations */ equals(other?: PdfObject): boolean; /** * Serializes the document to a Base64-encoded string. * * @returns A promise that resolves to the PDF document as a Base64 string */ toBase64(): string; abstract toJSON(): object; }