Represents a PDF document. Allows: loading, editing, manipulating, merging, signing printing and saving PDFs.

Remark

Make sure that you call close or cleanUp to free the memory, when you stop using the PdfDocument object.

Hierarchy

  • PdfDocument

Constructors

Properties

pdfDocumentId?: string

Internal PDF document ID

pdfPassword?: PdfPassword
promiseDocumentId?: Promise<string>

Methods

  • Adds a background to each page of this PDF. The background is copied from a first page in the backgroundPdf document.

    Parameters

    • fromPdf: PdfDocument

      background PDF document

    • sourcePageIndex: number = 0

      Index (zero-based page number) of the page to copy from the Background/Foreground PDF. Default is 0.

    • Optional applyToPages: PdfPageSelection

      PageSelection to which the background/foreground will be added. Default is "all"

    Returns Promise<void>

  • Adds a foreground to each page of this PDF. The background is copied from a first page in the backgroundPdf document.

    Parameters

    • fromPdf: PdfDocument

      foreground PDF document

    • sourcePageIndex: number = 0

      Index (zero-based page number) of the page to copy from the Background/Foreground PDF. Default is 0.

    • Optional applyToPages: PdfPageSelection

      PageSelection to which the background/foreground will be added. Default is "all"

    Returns Promise<void>

  • Add or Update a single metadata property

    Parameters

    • key: string
    • value: string

    Returns Promise<void>

  • Appends another PDF to the end of the current If AnotherPdfFile contains form fields, those fields will be appended with '' in the resulting PDF. e.g. 'Name' will be 'Name'

    Parameters

    Returns Promise<void>

  • Dispose this PdfDocument object (clean up the resource) This is necessary to free the memory used by PdfDocument. See cleanUp Once this method was called this PdfDocument object no longer usable.

    Returns Promise<void>

  • Compress existing PDF images using JPG encoding and the specified settings

    Parameters

    • imageQuality: number

      Quality (1 - 100) to use during compression

    • scaleToVisibleSize: boolean = false

      Scale down the image resolution according to its visible size in the PDF document

    Returns Promise<void>

  • Convert the current document into the specified PDF-A standard format

    Parameters

    • Optional customICC: string

      (Optional) Custom color profile file path

    Returns Promise<void>

  • Convert the current document into the specified PDF/UA standard format

    Returns Promise<void>

  • Gets a Map<string, string> of metadata properties

    Returns Promise<Map<string, string>>

  • Gets the number of pages in the PdfDocument.

    Returns Promise<number>

  • Inserts another PDF into the current PdfDocument, starting at a given Page Index. If AnotherPdfFile contains form fields, those fields will be appended with '' in the resulting PDF. e.g. 'Name' will be 'Name'

    Parameters

    • fromPdfDocument: PdfDocument

      Another PdfDocument

    • insertAtPageIndex: number

      Index at which to insert the new content. Note: Page 1 has index 0...

    Returns Promise<void>

  • Check if PdfDocument was signed or not

    Returns Promise<boolean>

  • Makes this PDF document read only such that: Content is encrypted at 128 bit. Copy and paste of content is disallowed. Annotations and form editing are disabled.

    Parameters

    • ownerPassword: string

      The owner password for the PDF. A string for owner password is required to enable PDF encryption and all document security options.

    Returns Promise<void>

  • Sets a whole metadata properties Map<string, string> (override all the metadata property)

    Parameters

    • newMetadataDictionary: Map<string, string>

      new metadata properties Map<string, string>

    Returns Promise<void>

  • Adds another PDF to the beginning of the current PdfDocument If AnotherPdfFile contains form fields, those fields will be appended with '' in the resulting PDF. e.g. 'Name' will be 'Name'

    Parameters

    Returns Promise<void>

  • Renders the PDF and exports image Files in convenient formats. 1 image file is created for each page. Running number will append output file path.

    Parameters

    Returns Promise<string[]>

    array of images file name as string[]

  • Remove a single metadata property

    Parameters

    • key: string

    Returns Promise<void>

  • Removes all user and owner password security for a PDF document. Also disables content encryption. If content is encrypted at 128 bit, copy and paste of content, annotations and form editing may be disabled.

    Returns Promise<void>

  • Replace the specified old text with new text on a given page

    Parameters

    • oldText: string

      Old text to remove

    • newText: string

      New text to add

    • Optional onPages: PdfPageSelection

      Page index to search for old text to replace (default "all")

    Returns Promise<void>

  • Sets the user password and enables 128Bit encryption of PDF content. A user password is a password that each user must enter to open or print the PDF document.

    Parameters

    • userPassword: string

    Returns Promise<void>

  • Count the number signature that signed to this PdfDocument

    Returns Promise<number>

  • Converts multiple image files to a PDF document. Each image creates 1 page which matches the image dimensions. The default PaperSize is A4. You can set it via ImageToPdfConverter.PaperSize. Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.

    Parameters

    Returns Promise<PdfDocument>

  • Static method that joins (concatenates) multiple PDF documents together into one compiled PDF document. If the PDF contains form fields the form field in the resulting PDF's name will be appended with '_{index}' e.g. 'Name' will be 'Name_0'

    Parameters

    Returns Promise<PdfDocument>

Generated using TypeDoc