template-pdf-generator
Advanced tools
Comparing version 1.0.1 to 1.0.2
const wkhtmltopdf = require('wkhtmltopdf'); | ||
const Twig = require('twig'), twig = Twig.twig; | ||
const pdfGenerator = function(data, template, css) { | ||
const pdfGenerator = function(data, template, css, options) { | ||
const renderedTemplate = `<html> | ||
@@ -18,5 +18,5 @@ <head> | ||
return wkhtmltopdf(renderedTemplate); | ||
return wkhtmltopdf(renderedTemplate, options); | ||
} | ||
module.exports = pdfGenerator; |
{ | ||
"name": "template-pdf-generator", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Generate a pdf from a template and some json data.", | ||
@@ -5,0 +5,0 @@ "main": "generator.js", |
# Génération de pdf à partir de données | ||
Ceci est un petit script en node qui permet de générer un pdf, à partir de données au format json et d'un template [twig](https://twig.symfony.com/). | ||
Il utilise [wkhtmltopdf](https://wkhtmltopdf.org/). | ||
Il utilise [wkhtmltopdf](https://wkhtmltopdf.org/). Il faut que wkhtmltopdf soit installé. | ||
@@ -6,0 +6,0 @@ ### Installation : |
# Template pdf generator | ||
This is a small nodejs-script that generates a pdf-file, given some data and a [twig](https://twig.symfony.com/) template. | ||
It uses [wkhtmltopdf](https://wkhtmltopdf.org/). | ||
It uses [wkhtmltopdf](https://wkhtmltopdf.org/) through the [wkhtmltopdf node package](https://github.com/devongovett/node-wkhtmltopdf). wkhtmltopdf has to be installed. | ||
@@ -29,2 +29,8 @@ ### Installation | ||
You can also use some options: | ||
``` | ||
pdfGenerator(data, template, css, options) | ||
``` | ||
The `options` object is the same as documented in the [wkhtmltopdf node package](https://github.com/devongovett/node-wkhtmltopdf#options). | ||
### Usage as a command line tool | ||
@@ -31,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4400
55