0.1.0 • Published 3 years ago

netlify-plugin-generate-pdf v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Netlify Plugin Generate PDF

Generate a PDF from the provided URL and save it to publish directory.

Install

npm install -D netlify-plugin-generate-pdf

And add this to your netlify.toml

[[plugins]]
  package = "netlify-plugin-generate-pdf"

  [plugins.inputs]
  # It has to begin with http
  url="https://your-site.netlify.app/"

Configuration

The following inputs options are available.

NameTypeDescriptionDefault valueRequired
urlstringabosulte path to generate PDF from-true
fileNamestringname of generated PDF fileindex.pdffalse
formatstringPrint formatA4false
printBackgroundbooleanEnable if you want to print images and backgroundstruefalse
displayHeaderFooterbooleanAdd a header and footer to each pagefalsefalse
headerTemplatestringHTML for page header-false
footerTemplatestringHTML for page footer-false
marginobjectPage margin{ top: '1cm', right: '1cm', bottom: '1cm', left: '1cm' }false

Example

[[plugins]]
  package = "netlify-plugin-generate-pdf"
  [plugins.inputs]
  url="https://google.com/"
  fileName = "google.pdf"
  format = "A4"
  printBackground = "true"
  displayHeaderFooter = "true"
  headerTemplate = "<div>Hello from PDF page header</div>"
  footerTemplate = "<div>Hello from PDF page footer</div>"
  [plugins.inputs.margin]
    top = '2cm'
    right = '2cm'
    bottom = '2cm'
    left = '2cm'
0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago