UNPKG

@syncfusion/ej2-pdf

Version:

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

614 lines (613 loc) 21.3 kB
import { PdfXmpSchema } from './pdf-xmp-schema'; import { PdfXmpSchemaType } from '../enumerator'; import { PdfXmpLangArray } from '../pdf-type'; import { PdfXmpMetadata } from './pdf-xmp-metadata'; /** Represents standard Dublin Core metadata for document description. * ```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 xmp: PdfXmpMetadata = documentProperties.xmpMetadata; * // Sets the creator * xmp.dublinCoreSchema.creator = ['Author Name']; * // Assign to documentProperties * documentProperties.xmpMetadata = xmp; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ export declare class PdfDublinCoreSchema extends PdfXmpSchema { private _coverage; private _identifier; private _source; private _format; private _contributor; private _creator; private _date; private _publisher; private _relation; private _subject; private _type; private _description; private _rights; private _title; /** * Initializes a new `PdfDublinCoreSchema` 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 dublincore: PdfDublinCoreSchema = documentProperties.xmpMetadata.dublinCoreSchema; * // Gets the schema type * let schemaType: PdfXmpSchemaType = dublincore.schemaType; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ readonly schemaType: PdfXmpSchemaType; /** * Gets the list of contributor (rdf:Bag). * * @returns {string[]} The list of contributor. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access contributor from Dublin Core schema * let contributor: string[] = xmpMetadata.dublinCoreSchema.contributor; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the list of contributor (rdf:Bag). * * @param {string[]} value The list of contributor to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets contributor * xmp.dublinCoreSchema.contributor = ['Contributor 1', 'Contributor 2']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ contributor: string[]; /** * Gets the list of creator (rdf:Seq). * * @returns {string[]} The list of creator. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access creator from Dublin Core schema * let creator: string[] = xmpMetadata.dublinCoreSchema.creator; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the list of creator (rdf:Seq). * * @param {string[]} value The list of creator to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets creator * xmp.dublinCoreSchema.creator = ['Author Name']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ creator: string[]; /** * Gets list of the date (rdf:Seq). * * @returns {string[]} The list of date. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access date from Dublin Core schema * let date: string[] = xmpMetadata.dublinCoreSchema.date; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the list of date (rdf:Seq). * * @param {string[]} value The list of date to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets date * xmp.dublinCoreSchema.date = ['2024-01-15', '2024-02-20']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ date: string[]; /** * Gets the publishers (rdf:Bag). * * @returns {string[]} The publishers. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access publisher from Dublin Core schema * let publisher: string[] = xmpMetadata.dublinCoreSchema.publisher; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the publishers (rdf:Bag). * * @param {string[]} value The publishers to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets publisher * xmp.dublinCoreSchema.publisher = ['Publisher Name']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ publisher: string[]; /** * Gets the list of relation (rdf:Bag). * * @returns {string[]} The list of relation. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access relation from Dublin Core schema * let relation: string[] = xmpMetadata.dublinCoreSchema.relation; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the list of relation (rdf:Bag). * * @param {string[]} value The list of relation to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets relation * xmp.dublinCoreSchema.relation = ['Related Document 1', 'Related Document 2']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ relation: string[]; /** * Gets the list of subject (rdf:Bag). * * @returns {string[]} The list of subject. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access subject from Dublin Core schema * let subject: string[] = xmpMetadata.dublinCoreSchema.subject; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the list of subject (rdf:Bag). * * @param {string[]} value The list of subject to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets subject * xmp.dublinCoreSchema.subject = ['Subject 1', 'Subject 2', 'Subject 3']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ subject: string[]; /** * Gets the list of type (rdf:Bag). * * @returns {string[]} The list of type. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access type from Dublin Core schema * let type: string[] = xmpMetadata.dublinCoreSchema.type; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the list of type (rdf:Bag). * * @param {string[]} value The list of type to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets type * xmp.dublinCoreSchema.type = ['Report', 'Document']; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ type: string[]; /** * Gets the title (rdf:Alt). * * @returns {PdfXmpLangArray} The title value. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access title from Dublin Core schema * let title: PdfXmpLangArray = xmpMetadata.dublinCoreSchema.title; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the title (rdf:Alt). * * @param {PdfXmpLangArray} value The title to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets title * xmp.dublinCoreSchema.title = { 'en': 'Document Title', 'fr': 'Titre du Document' } as PdfXmpLangArray; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ title: PdfXmpLangArray; /** * Gets the description (rdf:Alt). * * @returns {PdfXmpLangArray} The description. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access description from Dublin Core schema * let description: PdfXmpLangArray = xmpMetadata.dublinCoreSchema.description; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the description (rdf:Alt). * * @param {PdfXmpLangArray} value The description to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets description * xmp.dublinCoreSchema.description = { 'en': 'Document Description', 'fr': 'Description du Document' } as PdfXmpLangArray; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ description: PdfXmpLangArray; /** * Gets the rights (rdf:Alt). * * @returns {PdfXmpLangArray} The rights value. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access rights from Dublin Core schema * let rights: PdfXmpLangArray = xmpMetadata.dublinCoreSchema.rights; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the rights (rdf:Alt). * * @param {PdfXmpLangArray} value The rights to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets rights * xmp.dublinCoreSchema.rights = { 'en': 'Copyright 2024', 'fr': 'Droits d\'auteur 2024' } as PdfXmpLangArray; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ rights: PdfXmpLangArray; /** * Gets the coverage. * * @returns {string} The coverage. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access coverage from Dublin Core schema * let coverage: string = xmpMetadata.dublinCoreSchema.coverage; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the coverage. * * @param {string} value The coverage to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets coverage * xmp.dublinCoreSchema.coverage = 'Global Coverage'; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ coverage: string; /** * Gets the identifier. * * @returns {string} The identifier. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access identifier from Dublin Core schema * let identifier: string = xmpMetadata.dublinCoreSchema.identifier; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the identifier. * * @param {string} value The identifier to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets identifier * xmp.dublinCoreSchema.identifier = 'DOC-2024-001'; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ identifier: string; /** * Gets the source. * * @returns {string} The source. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access source from Dublin Core schema * let source: string = xmpMetadata.dublinCoreSchema.source; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the source. * * @param {string} value The source to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets source * xmp.dublinCoreSchema.source = 'Original Document Source'; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ source: string; /** * Gets the format. * * @returns {string} The format. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Gets XMP metadata * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmpMetadata = documentProperties.xmpMetadata; * // Access format from Dublin Core schema * let format: string = xmpMetadata.dublinCoreSchema.format; * // Destroy the document * document.destroy(); * ``` */ /** * Sets the format. * * @param {string} value The format to set. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Access the document properties * let documentProperties: PdfDocumentInformation = document.getDocumentInformation(false); * // Gets the xmp metadata * let xmp = documentProperties.xmpMetadata; * // Sets format * xmp.dublinCoreSchema.format = 'application/pdf'; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ format: string; }