Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinjagodic/netlify-plugin-generate-pdf
Generate a PDF from HTML at the provided URL and save it to publish directory.
https://github.com/martinjagodic/netlify-plugin-generate-pdf
html-to-pdf netlify netlify-plugin pdf
Last synced: 4 months ago
JSON representation
Generate a PDF from HTML at the provided URL and save it to publish directory.
- Host: GitHub
- URL: https://github.com/martinjagodic/netlify-plugin-generate-pdf
- Owner: martinjagodic
- License: mit
- Created: 2021-02-28T14:33:38.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-07T20:41:36.000Z (almost 4 years ago)
- Last Synced: 2024-10-20T05:33:32.307Z (4 months ago)
- Topics: html-to-pdf, netlify, netlify-plugin, pdf
- Language: JavaScript
- Homepage:
- Size: 1.54 MB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 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`
```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.
| Name | Type | Description | Default value | Required |
| ------------------- | ------- | -------------------------------------------------- | -------------------------------------------------------- | -------- |
| url | string | abosulte path to generate PDF from | - | true |
| fileName | string | name of generated PDF file | index.pdf | false |
| format | string | Print format | A4 | false |
| printBackground | boolean | Enable if you want to print images and backgrounds | true | false |
| displayHeaderFooter | boolean | Add a header and footer to each page | false | false |
| headerTemplate | string | HTML for page header | - | false |
| footerTemplate | string | HTML for page footer | - | false |
| margin | object | Page margin | { top: '1cm', right: '1cm', bottom: '1cm', left: '1cm' } | false |### Example
```toml
[[plugins]]
package = "netlify-plugin-generate-pdf"
[plugins.inputs]
url="https://google.com/"
fileName = "google.pdf"
format = "A4"
printBackground = "true"
displayHeaderFooter = "true"
headerTemplate = "Hello from PDF page header"
footerTemplate = "Hello from PDF page footer"
[plugins.inputs.margin]
top = '2cm'
right = '2cm'
bottom = '2cm'
left = '2cm'
```