@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
146 lines (145 loc) • 4.39 kB
TypeScript
import { _XmlWriter } from '../import-export/xml-writer';
import { PdfXmpSchemaType } from '../enumerator';
import { PdfXmpMetadata } from './pdf-xmp-metadata';
/**
* Represents core XMP metadata properties for a PDF document.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the document properties
* let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets creator tool
* xmp.basicSchema.creatorTool = 'MyApp 1.0';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare abstract class PdfXmpSchema {
/**
* Parent PdfXmpMetadata reference.
*
* @private
*/
_xmp: PdfXmpMetadata;
/**
* Map storing all properties for this schema.
*
* @private
*/
_properties: Map<string, any>;
/**
* Custom namespace URI for custom schemas.
*
* @private
*/
_customNamespaceUri?: string;
/**
* Namespace prefix for this schema.
*
* @private
*/
_prefix: string;
/**
* Schema name identifier.
*
* @private
*/
_name: string;
/**
* Initializes a new `PdfXmpSchema` instance.
*
* @private
* @param {PdfXmpMetadata} xmp Optional parent PdfXmpMetadata reference.
*/
constructor(xmp?: PdfXmpMetadata);
/**
* Gets the schema type.
*
* @returns {PdfXmpSchemaType} The schema type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Access the document properties
* let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false);
* // Gets the dublincore schema from the XMP metadata
* let basic: PdfBasicSchema = documentProperties.xmpMetadata.basicSchema;
* // Gets the schema type
* let schemaType: PdfXmpSchemaType = basic.schemaType;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
abstract readonly schemaType: PdfXmpSchemaType;
/**
* Stores a property value in the schema map.
* Skips null/undefined values. Normalizes Date to ISO 8601 UTC (no ms). Normalizes boolean to "True"/"False".
*
* @private
* @param {string} key The property key.
* @param {any} value The property value.
* @returns {void}
*/
_setProperty(key: string, value: any): void;
/**
* Retrieves a property value from the schema map.
*
* @private
* @param {string} key The property key.
* @returns {any} The stored value, or undefined if not set.
*/
_getProperty(key: string): any;
/**
* Returns the namespace URI for this schema based on its prefix.
*
* @private
* @returns {string} The namespace URI.
*/
_getNamespaceUri(): string;
/**
* Serializes all schema properties to RDF/XML using the provided writer.
* Iterates sorted property keys; dispatches each to the appropriate value writer.
*
* @private
* @param {_XmlWriter} writer The XML writer to serialize into.
* @returns {void}
*/
_writeXml(writer: _XmlWriter): void;
/**
* Check the value is the langArray value or not.
*
* @private
* @param {any} value is need to check.
* @returns {boolean} boolean value of is langArray or not
*/
private _isLangArray;
/**
* Check the value is the thumbnail structure value or not.
*
* @private
* @param {any} value is need to check.
* @returns {boolean} boolean value of is ThumbnailStruct or not
*/
private _isThumbnailStruct;
/**
* Gets the array type of the value.
*
* @private
* @param {string} key to get the array type.
* @returns {string} the array type of the element.
*/
private _getArrayType;
/**
* Gets the Namesapce URI for the given prefix.
*
* @private
* @param {string} pfx value to get the namespace URI.
* @returns {string} the URI value for the given prefix.
*/
private _getNamespaceUriForPrefix;
}