https://github.com/jsreport/jsreport-chrome-pdf
jsreport recipe using headless chrome for the pdf rendering
https://github.com/jsreport/jsreport-chrome-pdf
Last synced: about 1 year ago
JSON representation
jsreport recipe using headless chrome for the pdf rendering
- Host: GitHub
- URL: https://github.com/jsreport/jsreport-chrome-pdf
- Owner: jsreport
- License: lgpl-3.0
- Created: 2017-09-01T17:39:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-20T16:34:06.000Z (almost 5 years ago)
- Last Synced: 2025-03-27T11:43:34.053Z (about 1 year ago)
- Language: JavaScript
- Size: 1.07 MB
- Stars: 10
- Watchers: 5
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**⚠️ This repository has been moved to the monorepo [jsreport/jsreport](https://github.com/jsreport/jsreport)**
--
# jsreport-chrome-pdf
[](https://npmjs.com/package/jsreport-chrome-pdf)
[](https://travis-ci.org/jsreport/jsreport-chrome-pdf)
> jsreport recipe which is rendering pdf and images from html using headless chrome
See the docs
- https://jsreport.net/learn/chrome-pdf
- https://jsreport.net/learn/chrome-image
## Installation
> **npm install jsreport-chrome-pdf**
## Usage
To use `recipe` in for template rendering set `template.recipe=chrome-pdf` or `template.recipe=chrome-image` according to your needs in the rendering request.
chrome-pdf
```js
{
template: { content: '...', recipe: 'chrome-pdf', engine: '...', chrome: { ... } }
}
```
chrome-image
```js
{
template: { content: '...', recipe: 'chrome-image', engine: '...', chromeImage: { ... } }
}
```
## jsreport-core
You can apply this extension also manually to [jsreport-core](https://github.com/jsreport/jsreport-core)
```js
var jsreport = require('jsreport-core')()
jsreport.use(require('jsreport-chrome-pdf')())
```
## Troubleshooting
#### Table with a lot of rows never finish rendering
When rendering a table with a lot of rows (>4000) chrome can hang if the html contains a 5 level of tab indentation in the source, the fix for this is to keep the tab indentation bellow 4 levels. you can take a look at the problem [here](https://playground.jsreport.net/studio/workspace/ByLeJOiIM/7) and see how it is fixed by just updating the indentation [here](https://playground.jsreport.net/studio/workspace/rkvURPi8z/7).