Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IDocument

interface

IDocument

desc

Document represents a PdfMemDocument, construct from an existing pdf document. Document is the core class for reading and manipulating PDF files and writing them back to disk. Document was designed to allow easy access to the object structure of a PDF file. Document should be used whenever you want to change the object structure of a PDF file.

Hierarchy

Index

Constructors

constructor

Properties

baseUri

baseUri: string

body

body: IObj[]

catalog

catalog: IObj

encrypt

encrypt: IEncrypt

form

form: IForm

info

info: NPDFInfo

language

language: string

pageLayout

pageLayout: NPDFPageLayout

pageMode

pageMode: NPDFPageMode

password

password: string

printingScale

printingScale: string

trailer

trailer: IObj

version

version: NPDFVersion

Methods

__ptrCount

  • __ptrCount(): number

addDestination

append

attachFile

  • attachFile(file: string, document: IBase): void

centerWindow

  • centerWindow(): void

createFont

createPage

createPages

  • createPages(rects: IRect[]): number

displayDocTitle

  • displayDocTitle(): void

fitWindow

  • fitWindow(): void

gc

  • gc(file: string, pwd: string, output: string, cb: Callback): void
  • Performs garbage collection on the document. All objects not reachable by the trailer or deleted.

    Parameters

    • file: string

      pdf document

    • pwd: string

      if document is password protected this parameter is required

    • output: string

      file location

    • cb: Callback

      function

    Returns void

getAttachment

getFont

  • getFont(name: string): IFont
  • Looks for a font containg the provided name or id. This operation may be expensive as it iterates all pdf object searching for the font. If nothing is found null is returned

    Parameters

    • name: string

      font name or font id

    Returns IFont

getNames

getOutlines

  • getOutlines(): IObj

getPage

  • getPage(n: number): IPage

getPageCount

  • getPageCount(): number

getWriteMode

hideMenubar

  • hideMenubar(): void

hideToolbar

  • hideToolbar(): void

hideWindowUI

  • hideWindowUI(): void

insertExistingPage

  • insertExistingPage(memDoc: IDocument, index: number, insertIndex: number): number

insertPage

insertPages

  • insertPages(fromDoc: IDocument, startIndex: number, count: number): number
  • Copies one or more pages from another pdf to this document This function copies the entire document to the target document and then deletes pages that are not of interest. This is a much faster process, but without object garbage collection the document may result in a much larger than necessary document

    see

    {IDocument#gc}

    Parameters

    • fromDoc: IDocument

      PdfMemDocument to append

    • startIndex: number

      first page to copy (0-based)

    • count: number

      number of pages to copy

    Returns number

isAllowed

isLinearized

  • isLinearized(): boolean

load

  • load(file: string | Buffer, opts: object, cb: Callback): void
  • load(file: string | Buffer, cb: Callback): void
  • Parameters

    • file: string | Buffer
    • opts: object
      • Optional forUpdate?: undefined | true | false
      • Optional fromBuffer?: undefined | true | false
      • Optional password?: undefined | string
    • cb: Callback

    Returns void

  • Parameters

    Returns void

splicePages

  • splicePages(startIndex: number, count: number): void
  • Deletes one or more pages from the document by removing the pages reference from the pages tree. This does NOT remove the page object as the page object may be used by other objects in the document.

    Parameters

    • startIndex: number

      first page to delete (0-based)

    • count: number

      number of pages to delete

    Returns void

useFullScreen

  • useFullScreen(): void

write

  • Persist the document with any changes applied to either a new nodejs buffer or to disk.

    Parameters

    • destination: Callback | string

      file path or callback function

    • Optional cb: Callback

      if file path was provided as destination, this must be a callback function

    Returns void

Generated using TypeDoc