/** * PDF resource dictionary merger — structured merging at the parsed object level. * * Instead of manipulating serialized PDF dict strings directly, this module * parses resource dicts into a structured `PdfResourceDict` (nested Maps), * merges them, and serializes back to PDF dict strings. */ /** * Structured representation of a PDF resource dictionary. * * Outer key: category name (e.g. `Font`, `XObject`, `ExtGState`, `ColorSpace`, * `Pattern`, `Shading`, `Properties`). * Inner key: resource name (e.g. `F1`, `Im1`, `GS0`). * Value: serialized ref or value string (e.g. `3 0 R`, `/DeviceRGB`). * * Categories whose value is not a sub-dict (e.g. `/ProcSet [/PDF /Text]`) * are stored with an empty inner key `""` mapping to the raw value string. */ export type PdfResourceDict = Map>; /** * Merge two parsed resource dicts. For sub-dict categories, entries are * combined; overlay entries win on name collision. For non-sub-dict categories, * the overlay value replaces the original. */ export declare function mergeResourceDicts(original: PdfResourceDict, overlay: PdfResourceDict): PdfResourceDict; /** * Parse a serialized PDF resource dict string into a structured `PdfResourceDict`. * * Handles top-level entries like: * ``` * << /Font << /F1 3 0 R /F2 5 0 R >> /XObject << /Im1 7 0 R >> /ProcSet [/PDF /Text] >> * ``` * * Sub-dict categories (`Font`, `XObject`, etc.) are parsed into inner name→value maps. * Other categories are stored with a single entry keyed by `""`. */ export declare function parseResourceDict(dictStr: string): PdfResourceDict; /** * Serialize a structured `PdfResourceDict` back to a PDF dict string. */ export declare function serializeResourceDict(dict: PdfResourceDict): string;