Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panosoft/prince-promise
Convert HTML to PDF using a promise based api for PrinceXML.
https://github.com/panosoft/prince-promise
Last synced: about 2 months ago
JSON representation
Convert HTML to PDF using a promise based api for PrinceXML.
- Host: GitHub
- URL: https://github.com/panosoft/prince-promise
- Owner: panosoft
- Created: 2015-07-28T14:23:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T20:53:59.000Z (almost 7 years ago)
- Last Synced: 2024-10-06T03:56:11.120Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# prince-promise
Convert HTML to PDF using a promise based api for [PrinceXML](http://www.princexml.com/).
[![npm version](https://img.shields.io/npm/v/prince-promise.svg)](https://www.npmjs.com/package/prince-promise)
[![npm license](https://img.shields.io/npm/l/prince-promise.svg)](https://www.npmjs.com/package/prince-promise)
[![Travis](https://img.shields.io/travis/panosoft/prince-promise.svg)](https://travis-ci.org/panosoft/prince-promise)
[![David](https://img.shields.io/david/panosoft/prince-promise.svg)](https://david-dm.org/panosoft/prince-promise)
[![npm downloads](https://img.shields.io/npm/dm/prince-promise.svg)](https://www.npmjs.com/package/prince-promise)## Installation
```sh
npm install prince-promise
```## Usage
```js
var prince = require('prince-promise');var html = 'Hello';
var options = {
licenseFile: 'path',
encrypt: true
};prince(html)
.then(function (pdf) {
// ...
});
```## API
- [`prince`](#prince)
---
#### prince ( html [, options] )Converts an HTML string to a PDF. Returns a `Promise` that is fulfilled with the `pdf` buffer.
__Arguments__
- `html` - A string of HTML content to render.
- `options` - An object of options to run `prince` with. All [PrinceXml options](http://www.princexml.com/doc/command-line/) are supported and should be set as camelCased properties of this object.For instance:
```sh
prince --license-file=path --encrypt
```Becomes:
```js
var options = {
licenseFile: 'path',
encrypt: true
};
```