Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Document

class

Document

example

import {Document} from 'npdf' const doc = new Document('/path/to/file') const pageCount = doc.getPageCount() const page = doc.getPage(0) // pages are zero indexed const mergeDocs = doc.mergeDocument('/path/to/other/doc') doc.setPassword('secret') doc.write('/file/destination') const fileBuffer = fs.readFile('/file/destination', (e,d) => e ? e : d) // do something with the file or the file buffer

Hierarchy

  • Document

Implements

Index

Constructors

constructor

  • new Document(file: string, update?: boolean): Document
  • constructor

    Parameters

    • file: string
    • Default value update: boolean = false

    Returns Document

    void

Properties

Private _instance

_instance: any

Private _loaded

_loaded: boolean = false

Private _pageCount

_pageCount: number

Private _password

_password: string

Accessors

pageCount

  • get pageCount(): number

password

  • get password(): string
  • set password(value: string): void

Methods

deletePage

  • deletePage(pageIndex: number): void

getPage

  • getPage(pageN: number): IPage

getPageCount

  • getPageCount(): number

getVersion

  • getVersion(): number

isLinearized

  • isLinearized(): boolean

load

  • load(file: string): void
  • description

    load pdf file

    Parameters

    • file: string

      pdf file path

    Returns void

mergeDocument

  • mergeDocument(doc: string): void

write

  • write(file: string): void

Generated using TypeDoc