3.2.0 • Published 2 years ago
@hoast/process-pdf v3.2.0
@hoast/process-pdf
Converts HTML to PDF using Puppeteer.
Install
npm install @hoast/process-pdfOptions
{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 = falseOptional dot notation path to Puppeteer PDF options property on the data. Will override thepdfOptionsoption.{String} mediaType = falseSet to eitherprintorscreento change the pages media type.{Object} pdfOptions = {}Puppeteer PDF options. Will be overwritten by data at theoptionsPropertypath.{Object} serveOptions = {}Options for local server handling HTML requests from puppeteer.{String} directory = nullDirectory to server from, can be relative to process directory or an absolute directory.{Number} port = 3000Port 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 tofalseto disable wrapping.{Function} filter = nullCustom filter function. The item data is given as the parameter. Returntrueif it should be processed, returnfalseif this processor should be skipped.{Number} logLevel = 2Log 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.