UNPKG

@syncfusion/ej2-pdf

Version:

Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.

209 lines (208 loc) 6.09 kB
import { PdfXmpMetadata } from './pdf-xmp-metadata'; /** * Internal XML reader for parsing XMP metadata from PDF streams. * Reads RDF/XML format and reconstructs PdfXmpMetadata with all schemas. * * @private */ export declare class _XmlReader { private _xmlDoc; private _xmp; /** * Loads and parses XML data from a byte array or string. * * @private * @param {Uint8Array | string} data The XML data to parse. * @returns {void} */ _load(data: Uint8Array | string): void; /** * Validates the parsed XML document for errors. * * @private * @param {Document} doc The XML document to validate. * @returns {void} */ private _validate; /** * Parses the loaded XML document into a PdfXmpMetadata object. * * @private * @returns {PdfXmpMetadata} The parsed metadata object. */ _parseXmp(): PdfXmpMetadata; /** * Locates the rdf:RDF root element in the XML document. * * @private * @returns {Element} The rdf:RDF element. */ private _getRdfRoot; /** * Parses a single rdf:Description node and routes to appropriate schema parser. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseSchemaNode; /** * Routes schema parsing based on namespace URI. * * @private * @param {string} prefix The namespace prefix. * @param {string} ns The namespace URI. * @param {Element} node The rdf:Description element. * @returns {void} */ private _mapSchema; /** * Parses Basic XMP schema properties. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseBasic; /** * Parses Dublin Core schema properties. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseDublinCore; /** * Parses PDF schema properties. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parsePdf; /** * Parses Paged-Text schema properties. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parsePagedText; /** * Parses Rights Management schema properties. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseRights; /** * Parses Basic Job Ticket schema properties. * * @private * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseJobTicket; /** * Parses custom schema properties. * * @private * @param {string} prefix The namespace prefix. * @param {string} ns The namespace URI. * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseInternalCustom; /** * Parses custom schema properties. * * @private * @param {string} prefix The namespace prefix. * @param {string} ns The namespace URI. * @param {Element} node The rdf:Description element. * @returns {void} */ private _parseCustom; /** * Gets a single text value from a child element. * * @private * @param {Element} node The parent element. * @param {string} tag The local name of the child element. * @returns {string} The text content or undefined. */ private _getValue; /** * Gets the full attribute name for a tag, checking all possible namespace prefixes. * * @private * @param {Element} node The element to check. * @param {string} localName The local name to search for. * @returns {string} The attribute name or null. */ private _getAttributeName; /** * Gets a Date value from a child element. * * @private * @param {Element} node The parent element. * @param {string} tag The local name of the child element. * @returns {Date} The parsed date or undefined. */ private _getDate; /** * Gets an array of string values from an rdf:Bag or rdf:Seq container. * * @private * @param {Element} node The parent element. * @param {string} tag The local name of the property element. * @returns {string[]} Array of string values. */ private _getArray; /** * Gets a multilingual array (language map) from an rdf:Alt container. * * @private * @param {Element} node The parent element. * @param {string} tag The local name of the property element. * @returns {PdfXmpLangArray} Language map object. */ private _getLangArray; /** * Gets an array of structured thumbnail objects from an rdf:Bag container. * * @private * @param {Element} node The parent element. * @param {string} tag The local name of the property element. * @returns {PdfXmpThumbnail[]} Array of thumbnail structures. */ private _getThumbnails; /** * Finds a child element by local name (case-insensitive for namespaces). * * @private * @param {Element} node The parent element. * @param {string} localName The local name to search for. * @returns {Element} The found element or null. */ private _findChildElement; /** * Finds a direct child element by local name. * * @private * @param {Element} node The parent element. * @param {string} localName The local name to search for. * @returns {Element} The found element or null. */ private _findDirectChild; /** * Finds all direct child elements with the specified local name. * * @private * @param {Element} node The parent element. * @param {string} localName The local name to search for. * @returns {Element[]} Array of matching elements. */ private _findDirectChildren; }