0.1.0 • Published 6 years ago

@modernice/pdf-tool-server v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

PDF Tool Server

A collection of PDF tools packed in a Node.js webserver.

Setup

  1. Copy environment file
cp .env.example .env
  1. Install dependencies
yarn
  1. Build
yarn build
  1. Start server
yarn start

Usage

Create PDF from a webpage

Send a POST request to '/page-to-pdf' with the following options as JSON and save the returned data as a PDF file to your disk.

OptionRequiredDefaultTypeDescription
urlyes-stringURL to the webpage
selectorno-stringDOM selector (only use contents of this element)
waitUntilno'networkidle0''networkidle0''networkidle0''networkidle2''load''domcontentloaded'Page event that determines when the page has been loaded
waitForSelectorno-stringDOM selector (wait for the element to appear before capturing the page)
delayno-integerDelay caputure for given milliseconds after the page has loaded
formatno'A4''Letter''Legal''Tabloid''Ledger''A0''A1''A2''A3''A4''A5'The PDF size
authTokenno-stringUsed as authorization header when requesting the URL
viewport.widthno1920integerSet the viewport width of the browser window
viewport.heightno1080integerSet the viewport height of the browser window