@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
473 lines (472 loc) • 15.6 kB
TypeScript
import { PdfXmpSchema } from './pdf-xmp-schema';
import { PdfXmpSchemaType } from '../enumerator';
import { PdfXmpMetadata } from './pdf-xmp-metadata';
import { PdfXmpThumbnail } from '../pdf-type';
/**
* Represents the Basic Schema.
* ```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
* xmpMetadata.basicSchema.creatorTool = 'MyApp';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfBasicSchema extends PdfXmpSchema {
private _creatorTool;
private _label;
private _nickname;
private _baseUrl;
private _createDate;
private _modifyDate;
private _metadataDate;
private _advisory;
private _identifier;
private _thumbnails;
private _rating;
/**
* Initializes a new `PdfBasicSchema` 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 basic 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();
* ```
*/
readonly schemaType: PdfXmpSchemaType;
/**
* Gets the creator tool.
*
* @returns {string} The creatorTool 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 XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Access creator tool from basic schema
* let creatorTool: string = xmpMetadata.basicSchema.creatorTool;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the creator tool.
*
* @param {string} value The creatorTool to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // 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();
* ```
*/
creatorTool: string;
/**
* Gets the label.
*
* @returns {string} The label.
*
* ```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;
* // Access label from basic schema
* let label: string = xmpMetadata.basicSchema.label;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the label.
*
* @param {string} value The label to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets label
* xmp.basicSchema.label = 'Sample Label';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
label: string;
/**
* Gets the nickname.
*
* @returns {string} The nickname.
*
* ```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;
* // Access nickname from basic schema
* let nickname: string = xmpMetadata.basicSchema.nickname;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the nickname.
*
* @param {string} value The nickname to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets nickname
* xmp.basicSchema.nickname = 'My Document';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
nickname: string;
/**
* Gets the base URL.
*
* @returns {string} The base URL.
*
* ```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;
* // Access base URL from basic schema
* let baseUrl: string = xmpMetadata.basicSchema.baseUrl;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the base URL.
*
* @param {string} value The base URL to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets base URL
* xmp.basicSchema.baseUrl = 'https://example.com';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
baseUrl: string;
/**
* Gets the creation date.
*
* @returns {Date} The creation 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 XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Access creation date from basic schema
* let createDate: Date = xmpMetadata.basicSchema.createDate;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the creation date.
*
* @param {Date} value The createDate value to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets creation date
* xmp.basicSchema.createDate = new Date();
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
createDate: Date;
/**
* Gets the modification date.
*
* @returns {Date} The modification 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 XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Access modification date from basic schema
* let modifyDate: Date = xmpMetadata.basicSchema.modifyDate;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the modification date.
*
* @param {Date} value The modification date to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets modification date
* xmp.basicSchema.modifyDate = new Date();
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
modifyDate: Date;
/**
* Gets the metadata date.
*
* @returns {Date} The metadata 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 XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Access metadata date from basic schema
* let metadataDate: Date = xmpMetadata.basicSchema.metadataDate;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the metadata date.
*
* @param {Date} value The metadata date to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets metadata date
* xmp.basicSchema.metadataDate = new Date();
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
metadataDate: Date;
/**
* Gets the advisory.
*
* @returns {string[]} The advisory.
*
* ```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;
* // Access advisory from basic schema
* let advisory: string[] = xmpMetadata.basicSchema.advisory;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the advisory.
*
* @param {string[]} value The advisory to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets advisory
* xmp.basicSchema.advisory = ['Advisory 1', 'Advisory 2'];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
advisory: 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 XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Access identifier from basic schema
* let identifier: string[] = xmpMetadata.basicSchema.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);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets identifier
* xmp.basicSchema.identifier = ['ID-001', 'ID-002'];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
identifier: string[];
/**
* Gets the thumbnails.
*
* @returns {PdfXmpThumbnail[]} The thumbnails.
*
* ```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;
* // Access thumbnails from basic schema
* let thumbnails: PdfXmpThumbnail[] = xmpMetadata.basicSchema.thumbnails;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the thumbnails.
*
* @param {PdfXmpThumbnail[]} value The thumbnails to set.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Creates thumbnail array
* let thumbnailArray: PdfXmpThumbnail[] = [{width: 10, height: 10, format: 'JPEG'}]
* // Sets thumbnails (requires PdfXmpThumbnail objects)
* xmp.basicSchema.thumbnails = thumbnailArray;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
thumbnails: PdfXmpThumbnail[];
/**
* Gets the rating.
*
* @returns {number[]} The rating.
*
* ```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;
* // Access rating from basic schema
* let rating: number[] = xmpMetadata.basicSchema.rating;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the rating.
*
* @param {number[]} value The rating 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 XMP metadata
* let xmpMetadata: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets rating
* xmp.basicSchema.rating = [5, 4, 3];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
rating: number[];
}