UNPKG

@syncfusion/ej2-pdf

Version:

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

230 lines (229 loc) 8.75 kB
import { PdfRotationAngle } from './enumerator'; /** * `PdfPageImportOptions` class represents to customize the support of import PDF pages * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Sets the target page index to import * options.targetIndex = 1; * // Sets the rotation angle of the page to import * options.rotation = PdfRotationAngle.angle180; * // Sets the boolean value indicating whether the optimize resources while import pages or not * options.optimizeResources = true; * // Copy the first page and add it as second page with page rotation * document.importPage(0, options); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ export declare class PdfPageImportOptions { /** * Specifies the target page index at which the imported page will be inserted. * * @private */ _targetIndex: number; /** * Defines the rotation angle to be applied to the imported page. * * @private */ _rotation: PdfRotationAngle; /** * Indicates whether the resources of the imported page should be optimized to avoid duplication. * * @private */ _optimizeResources: boolean; /** * Determines whether form fields from the imported page must be grouped to avoid name conflicts. * * @private */ _groupFormFields: boolean; /** * Initializes a new instance of the `PdfPageImportOptions` class. * * @param {object} [options] Optional configuration. * @param {number} [options.targetIndex] Target page index to import. * @param {PdfRotationAngle} [options.rotation] Rotation angle of the page. * @param {boolean} [options.optimizeResources] Whether to optimize resources. * @param {boolean} [options.groupFormFields] Whether to group form fields. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions({ * targetIndex: 2, rotation: PdfRotationAngle.angle90, optimizeResources: true, * groupFormFields: false}); * // Copy the first page and add it as second page with page rotation * document.importPage(0, options); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); */ constructor(options?: { targetIndex?: number; rotation?: PdfRotationAngle; optimizeResources?: boolean; groupFormFields?: boolean; }); /** * Gets the target page index to import * * @returns {PdfRotationAngle} Page rotation angle. * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Gets the target page index to import * let targetIndex: number = options.targetIndex; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ /** * Sets the target page index to import * * @param {number} value Target page index to import. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Sets the target page index to import * options.targetIndex = 1; * // Copy the first page and add it as second page with page rotation * document.importPage(0, options); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ targetIndex: number; /** * Gets the rotation angle of the page to import * * @returns {PdfRotationAngle} Page rotation angle. * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Gets the rotation angle of the page to import * let rotation: PdfRotationAngle = options.rotation; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ /** * Sets the rotation angle of the page to import * * @param {PdfRotationAngle} value Page rotation angle. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Sets the rotation angle of the page to import * options.rotation = PdfRotationAngle.angle270; * // Copy the first page and add it as second page with page rotation * document.importPage(0, options); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ rotation: PdfRotationAngle; /** * Gets the boolean value indicating whether the optimize resources while import pages or not * * @returns {boolean} Indicates resource optimization. * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Gets the boolean value indicating whether the optimize resources while import pages or not * let resource: optimizeResources = options.optimizeResources; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ /** * Sets the boolean value indicating whether the optimize resources while import pages or not * * @param {boolean} value Indicates resource optimization. * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Sets the boolean value indicating whether the optimize resources while import pages or not * options.optimizeResources = true; * // Copy the first page and add it as second page with page rotation * document.importPage(0, options); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ optimizeResources: boolean; /** * Gets the boolean value indicating whether the form fields are grouped or not while importing pages. * * @returns {boolean} value Indicates form fields grouping. * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Gets the boolean value indicating whether the form fields are grouped or not while importing pages. * let groupFormfields: number = options.groupFormFields; * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ /** * Sets the boolean value indicating whether the form fields are grouped or not while importing pages. * * @param {boolean} value Indicates form fields grouping * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data); * // Options to customize the support of import PDF pages. * let options: PdfPageImportOptions = new PdfPageImportOptions(); * // Sets the boolean value indicating whether the form fields are grouped or not while importing pages. * options.groupFormFields = true; * // Copy the first page and add it as second page. * document.importPage(0, options); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ groupFormFields: boolean; }