Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Moleculer logo

Build Status Coverage Status Codacy Badge Code Climate David Known Vulnerabilities Join the chat at https://gitter.im/moleculerjs/moleculer

moleculer-pdf NPM version

Moleculer service to generate PDF

Features

Install

npm install moleculer-pdf --save

Usage

'use strict';

let { ServiceBroker } = require("moleculer");
let PDFService = require("../../index");
const { promisify } = require("util");
const { writeFile } = require("fs");
const writeFileAsync = promisify(writeFile);

// Create broker
let broker = new ServiceBroker({
  logger: console
});

// Load my service
broker.createService(PDFService);

// Start server
broker.start().then(() => {
  // Call action
  broker
    .call("pdf.transform", { html: "<h1>John Doe</h1>" })
    .then(buff => writeFileAsync("./pdf.pdf", buff))
    .catch(broker.logger.error);
});

Settings

Property Type Default Description
puppeteerArgs Object { headless: true } Set of configurable options to set on the browser
options Object { format: 'letter' } Set of configurable options to set pdf document
remoteContent Boolean true Content to load on webpage like

Actions

transform

Transform html to pdf document

Parameters

Property Type Default Description
html String required The html content

Results

Type: Buffer

  • Generated pdf document

Methods

transform

Transform html to pdf document

Parameters

Property Type Default Description
html String - The html content

Results

Type: Buffer

  • Generated pdf document

Test

$ npm test

In development with watching

$ npm run ci

Contribution

Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.

License

The project is available under the MIT license.

Contact

Copyright (c) 2019 moleculer-pdf

@icebob @icebob

About

Moleculer service to generate PDF

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published