https://github.com/jsreport/jsreport-phantom-image
jsreport recipe converting html into images
https://github.com/jsreport/jsreport-phantom-image
Last synced: 11 months ago
JSON representation
jsreport recipe converting html into images
- Host: GitHub
- URL: https://github.com/jsreport/jsreport-phantom-image
- Owner: jsreport
- License: lgpl-3.0
- Created: 2015-11-25T19:29:05.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-09-06T19:35:54.000Z (almost 5 years ago)
- Last Synced: 2025-04-10T23:17:23.745Z (about 1 year ago)
- Language: JavaScript
- Size: 202 KB
- Stars: 11
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
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-phantom-image
[](https://npmjs.com/package/jsreport-phantom-image)
[](https://travis-ci.org/jsreport/jsreport-phantom-image)
> jsreport recipe which is rendering images from html using phantomjs
## Installation
> **npm install jsreport-phantom-image**
## Usage
To use `recipe` in for template rendering set `template.recipe=phantom-image` in the rendering request.
```js
{
template: { content: '...', recipe: 'phantom-image', engine: '...', phantomImage: { ... } }
}
```
## 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-phantom-image')({ strategy: 'phantom-server' }))
```
## Configurations
- imageType - png, gif or jpeg, default png
- quality - quality (1-100) of output image, default 100
- printDelay - number of ms to wait before printing starts
- blockJavaScript - block running js on the page
- waitForJS - see [phantom-html-to-pdf](https://github.com/pofider/phantom-html-to-pdf) - the window variable to set in this case is `JSREPORT_READY_TO_START`