@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
261 lines (260 loc) • 9.32 kB
TypeScript
import { _XmlWriter } from '../import-export/xml-writer';
import { PdfXmpSchema } from './pdf-xmp-schema';
import { PdfXmpSchemaType } from '../enumerator';
import { PdfXmpDimensionsStruct } from '../pdf-type';
import { PdfXmpMetadata } from './pdf-xmp-metadata';
/**
Represents metadata for paginated text structure in 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 xmp: PdfXmpMetadata = documentProperties.xmpMetadata;
* // Sets page count
* xmp.pagedTextSchema.pageCount = 5;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfPagedTextSchema extends PdfXmpSchema {
private _pageCount;
private _MaxPageSize;
private _fonts;
private _plateNames;
private _Colorants;
/**
* Initializes a new `PdfPagedTextSchema` 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 paged text schema from the XMP metadata
* let pageTextSchema: PdfPagedTextSchema = documentProperties.xmpMetadata.pagedTextSchema;
* // Gets the schema type
* let schemaType: PdfXmpSchemaType = pageTextSchema.schemaType;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly schemaType: PdfXmpSchemaType;
/**
* Gets the page count.
*
* @returns {number} The number of pages.
*
* ```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 page count from paged text schema
* let pageCount: number = xmpMetadata.pagedTextSchema.pageCount;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the page count.
*
* @param {number} value The number of pages 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 page count
* xmp.pagedTextSchema.pageCount = 10;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
pageCount: number;
/**
* Gets the maximum page dimensions structure.
*
* @returns {PdfXmpDimensionsStruct} The maximum page dimensions.
*
* ```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 maximum page size from paged text schema
* let maxPageSize: PdfXmpDimensionsStruct = xmpMetadata.pagedTextSchema.maxPageSize;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the maximum page dimensions structure.
*
* @param {PdfXmpDimensionsStruct} value The maximum page dimensions 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 maximum page size
* xmp.pagedTextSchema.maxPageSize = { width: 8.5, heigth: 11, unit: 'in' };
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
maxPageSize: PdfXmpDimensionsStruct;
/**
* Gets the fonts collection (rdf:Bag).
*
* @returns {string[]} The fonts collection.
*
* ```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 fonts from paged text schema
* let fonts: string[] = xmpMetadata.pagedTextSchema.fonts;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the fonts collection (rdf:Bag).
*
* @param {string[]} value The fonts collection 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 fonts
* xmp.pagedTextSchema.fonts = ['Arial', 'Times New Roman', 'Helvetica'];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
fonts: string[];
/**
* Gets the plate names (rdf:Seq).
*
* @returns {string[]} The plate names.
*
* ```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 plate names from paged text schema
* let plateNames: string[] = xmpMetadata.pagedTextSchema.plateNames;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the plate names (rdf:Seq).
*
* @param {string[]} value The plate names 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 plate names
* xmp.pagedTextSchema.plateNames = ['CMYK Cyan', 'CMYK Magenta', 'CMYK Yellow', 'CMYK Black'];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
plateNames: string[];
/**
* Gets the colorants (rdf:Seq).
*
* @returns {string[]} The colorants.
*
* ```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 colorants from paged text schema
* let colorants: string[] = xmpMetadata.pagedTextSchema.colorants;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the colorants (rdf:Seq).
*
* @param {string[]} value The colorants 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 colorants
* xmp.pagedTextSchema.colorants = ['Cyan', 'Magenta', 'Yellow', 'Black'];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
colorants: string[];
/**
* Serializes all schema properties to RDF/XML using the provided writer.
* Overrides the base method to handle the PdfXmpDimensionsStruct for maxPageSize.
*
* @private
* @param {_XmlWriter} writer The XML writer to serialize into.
* @returns {void}
*/
_writeXml(writer: _XmlWriter): void;
}