import { ObjectManager } from "../ObjectManager"; import { ObjectBase } from "../ObjectBase"; import { EmbeddedFileStream } from "./EmbeddedFileStream"; import type { EmbeddedFileStreamProperties } from "./EmbeddedFileStream"; import type { FileID } from "../Types"; import { PdfStringMap } from "./PdfStringMap"; /** * Represents a PDF file specification, defining how external files are referenced or embedded. * * This class implements the PDF specification for file references, supporting three primary methods: * * 1. **URI Reference** - Link to an external resource * - Use the `uri` property * * 2. **External File** - Reference to a non-embedded file * - Use the `fileName` property * * 3. **Embedded Stream** - File content embedded directly in the PDF * - Use the `stream` property * * **Usage Notes:** * - At least one of the three properties must be specified * - `fileName` and `stream` can be combined to create an embedded file with a specific name * * The {@link FileSpecification} class can be used in more complex cases. */ export type FileSpecificationProperties = { /** * The file name. */ fileName?: string; /** * The external uri. */ uri?: string; /** * The {@link EmbeddedFileStreamProperties} defining properties of embedded stream, */ stream?: EmbeddedFileStreamProperties; /** * The optional description. */ desc?: string; }; /** * Represents a PDF File Specification. * * The complex architecture of this class is based on the PDF Specification, * for full details please consult that spec. * * @see {@link FileSpecificationProperties} */ export declare class FileSpecification extends ObjectBase { /** * Creates a {@link FileSpecification} object on the base of properties specified by the * {@link FileSpecificationProperties}. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link FileSpecification}. * @param properties - The properties of created object. */ constructor(om: ObjectManager, properties: FileSpecificationProperties); /** * Creates a {@link FileSpecification} object on the base of properties specified by the * {@link FileSpecificationProperties}. * * @param properties - The properties of created object. */ constructor(properties: FileSpecificationProperties); /** * Creates a {@link FileSpecification} associated with the specified {@link EmbeddedFileStream} object. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link FileSpecification}. * @param fileName - The file name used as a name for embedded file. * @param stream - The {@link EmbeddedFileStream} associated with created file specification. * @param desc - The optional description. */ constructor(om: ObjectManager, fileName: string, stream: EmbeddedFileStream, desc?: string); /** * Creates a {@link FileSpecification} associated with the specified {@link EmbeddedFileStream} object. * * @param fileName - The file name used as a name for embedded file. * @param stream - The {@link EmbeddedFileStream} associated with created file specification. * @param desc - The optional description. */ constructor(fileName: string, stream: EmbeddedFileStream, desc?: string); /** * Gets a value indicating that this file specification has at least one * {@link EmbeddedFileStream} associated with it. */ getStream(): Uint8Array | null; /** * Gets a value indicating that this file specification has at least one * {@link EmbeddedFileStream} associated with it. */ get hasEmbeddedFileStream(): boolean; /** * Gets or sets the file system to be used to interpret this file specification. * * If this property is present, all other properties are interpreted by the designated file system. * PDF defines only one standard file system name, URL; * an application or plug-in extension can register other names. */ get fileSystem(): string | null; /** * Gets or sets the file system to be used to interpret this file specification. * * If this property is present, all other properties are interpreted by the designated file system. * PDF defines only one standard file system name, URL; * an application or plug-in extension can register other names. */ set fileSystem(value: string | null); /** * Gets or sets the {@link FileID} object specifying the ID of the referenced file. * * This property improves an application's chances of finding the intended file and allows it to warn * the user if the file has changed since the link was made. */ get ID(): FileID | null; /** * Gets or sets the {@link FileID} object specifying the ID of the referenced file. * * This property improves an application's chances of finding the intended file and allows it to warn * the user if the file has changed since the link was made. */ set ID(value: FileID | null); /** * Gets or sets a value indicating whether the file referenced by the file specification is volatile * (changes frequently with time). If the value is true, applications should never cache a copy of the file. */ get volatile(): boolean; /** * Gets or sets a value indicating whether the file referenced by the file specification is volatile * (changes frequently with time). If the value is true, applications should never cache a copy of the file. */ set volatile(value: boolean); /** * Gets or sets the description of this File Specification. */ get desc(): string | null; /** * Gets or sets the description of this File Specification. */ set desc(value: string | null); /** * Gets or sets a value that represents the relationship of this object * to the source that points to it. * * Predefined values are **Source**, **Data**, **Alternative**, * **Supplement** and **Unspecified**. */ get relationship(): string | null; /** * Gets or sets a value that represents the relationship of this object * to the source that points to it. * * Predefined values are **Source**, **Data**, **Alternative**, * **Supplement** and **Unspecified**. */ set relationship(value: string | null); } /** * The dictionary of file specifications. **/ export declare class FileSpecificationMap extends PdfStringMap { private constructor(); static innerCreate(om: ObjectManager, id: number): FileSpecificationMap; get count(): number; get(key: string): FileSpecification | undefined; set(key: string, item: FileSpecification): void; add(key: string, item: FileSpecification | FileSpecificationProperties | Uint8Array): void; contains(key: string): boolean; remove(key: string): boolean; clear(): void; }