@hoast/process-pdf
v3.2.0
Published
Converts HTML to PDF using puppeteer.
Downloads
8
Readme
@hoast/process-pdf
Converts HTML to PDF using Puppeteer.
Install
npm install @hoast/process-pdf
Options
{String} property = 'contents'
Dot notation path to the data property which should be processed.{String} setProperty = 'contents'
Dot notation path to the data property to which the result should be written.{String} optionsProperty = false
Optional dot notation path to Puppeteer PDF options property on the data. Will override thepdfOptions
option.{String} mediaType = false
Set to eitherprint
orscreen
to change the pages media type.{Object} pdfOptions = {}
Puppeteer PDF options. Will be overwritten by data at theoptionsProperty
path.{Object} serveOptions = {}
Options for local server handling HTML requests from puppeteer.{String} directory = null
Directory to server from, can be relative to process directory or an absolute directory.{Number} port = 3000
Port to serve from and link to.
{String} wrap = '<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>{0}</body></html>'
The string to wrap the content with where{0}
indicates the place for the content. Set tofalse
to disable wrapping.{Function} filter = null
Custom filter function. The item data is given as the parameter. Returntrue
if it should be processed, returnfalse
if this processor should be skipped.{Number} logLevel = 2
Log level given to the logger.
Security risk
Note this module serves the directory
options of hoast or serveOptions.directory
directory to the local network whilst it is processing files. This can be a potential security risk and expose information to the network you might not want to make available.