# template2pdf

> PDF conversion module using the template engine

Latest version **0.4.1** (published 2015-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install template2pdf
pnpm add template2pdf
yarn add template2pdf
bun add template2pdf
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2015-09-23 |
| First published | 2015-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Noritaka Horio |
| Maintainers | holyshared |

## Links

- npm: https://www.npmjs.com/package/template2pdf
- Repository: https://github.com/holyshared/template2pdf
- Homepage: https://github.com/holyshared/pdf#readme
- Issues: https://github.com/holyshared/pdf/issues
- npm.io page: https://npm.io/package/template2pdf

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [bluebird](https://npm.io/package/bluebird.md) ^2.10.0
- [phantom-html2pdf](https://npm.io/package/phantom-html2pdf.md) ^1.0.2

## Recent versions

- 0.4.1 (latest) — 2015-09-23
- 0.4.0 — 2015-09-22
- 0.3.0 — 2015-09-22
- 0.2.0 — 2015-09-20
- 0.1.0 — 2015-09-20

## README

template2pdf
======================

[![Build Status](https://travis-ci.org/holyshared/template2pdf.svg?branch=master)](https://travis-ci.org/holyshared/template2pdf)
[![Coverage Status](https://coveralls.io/repos/holyshared/template2pdf/badge.svg?branch=master&service=github)](https://coveralls.io/github/holyshared/template2pdf?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/55feb03c601dd9001c00003a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55feb03c601dd9001c00003a)
[![Stories in Ready](https://badge.waffle.io/holyshared/template2pdf.png?label=ready&title=Ready)](https://waffle.io/holyshared/template2pdf)

Installation
----------------------

    npm install template2pdf

Basic usage
--------------------------

Use the template engine, you can convert content to PDF.

```js
import jade from 'template2pdf-jade';
import exporter from 'template2pdf';

exporter(jade({ /* jade options */ }))
  .render('views/content.jade', { name: 'jade' })
  .then((result) => {
    return result.saveAs('/tmp/content.pdf');
  }).then(() => {
    //successful
  });
```

Stream
--------------------------

Using the Stream, you can also chain the output.

```js
import jade from 'template2pdf-jade';
import exporter from 'template2pdf';
import fs from 'fs';

exporter(jade({ /* jade options */ }))
  .render('views/content.jade', { name: 'jade' })
  .then((result) => {
    result.pipe(fs.createWriteStream('/tmp/stream.pdf'));
  });
```

Javascript & Stylesheet
--------------------------

You can incorporate your own stylesheets or javascript files.

```js
import exporter from 'template2pdf';
import jade from 'template2pdf-jade';
import { resolve } from 'path';

exporter(jade())
  .stylesheet('style.css')
  .javascript('main.js')
  .render(resolve(__dirname, './report.jade'), {
    title: 'jade-example',
    content: 'Example content'
  })
  .then((result) => {
    return result.saveAs('./report.pdf');
  }).then(() => {
    //successful
  });
```

---
_Source: https://npm.io/package/template2pdf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
