Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/paralect/pdf-service

A docker based service for pdf and image generation
https://github.com/paralect/pdf-service

docker node-module paralect-stack pdf pdf-generation pdf-service webpack

Last synced: 2 months ago
JSON representation

A docker based service for pdf and image generation

Awesome Lists containing this project

README

        

:scroll: PDF Service
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
===========
![Stack](https://raw.githubusercontent.com/paralect/stack/master/stack-component-template/stack.png)

###### [CLIENT API](client/README.md) | [SERVER API](server/README.md) | [CONTRIBUTING](CONTRIBUTING.md)
> Pdf service can be used for pdf generating (reports, receipts and etc.) from the html sources.

Features
========
Here are a few examples to get you started:

* :rocket: Generate PDF(screenshots) from the html as a string / file.
* :package: Build your assets without headache.

Installation
========

You should start pdf server first. It is easy to mange if you have docker:

```
docker pull paralect/pdf-service
docker run -d -p 3000:3000 paralect/pdf-service
```

After that install client library:

```
npm i @paralect/pdf-service-client
```

Quick example
=============
In your js file write these lines:

```
const PdfService = require('@paralect/pdf-service-client'); // require client pdf service library
const fs = require('fs'); // fs to write file

// pdf service init
const pdfService = new PdfService({
serverUrl: 'http://localhost:3000',
mode: 'development',
});

// generate pdf by html string
pdfService.generatePdfByContent('

Hello, {{name}}!

', {
pdfOptions: {
format: 'Letter',
},
templateSystem: {
params: {
name: 'Your name',
},
},
}).then((pdfStream) => {
const writeStream = fs.createWriteStream('./hello.pdf');

pdfStream.pipe(writeStream);

writeStream.on('finish', () => {
console.log('Hello pdf was created!');
});
});
```

Execution of this code should generate pdf file with 'Hello, Your name' string.

Full API Reference
=================
Explore the API documentation([client side](client/README.md) and [server side](server/README.md)) and [examples](client/samples) to learn more.

Change Log
=================

This project adheres to [Semantic Versioning](http://semver.org/).
Every release is documented on the Github [Releases](https://github.com/paralect/pdf-service/releases) page.

License
=================

Ship is released under the [MIT License](LICENSE).

Contributing
=================

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

Contributors
=================

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [
KuhArt](https://github.com/KuhArt)
[πŸ’»](https://github.com/paralect/pdf-service/commits?author=KuhArt "Code") [πŸ“–](https://github.com/paralect/pdf-service/commits?author=KuhArt "Documentation") [πŸ›](https://github.com/paralect/pdf-service/issues?q=author%3AKuhArt "Bug reports") | [
Uladzimir Mitskevich](https://github.com/umitskevich)
[πŸ€”](#ideas-umitskevich "Ideas, Planning, & Feedback") [πŸ›](https://github.com/paralect/pdf-service/issues?q=author%3Aumitskevich "Bug reports") | [
NesterenkoNikita](https://github.com/NesterenkoNikita)
[πŸ€”](#ideas-NesterenkoNikita "Ideas, Planning, & Feedback") [πŸ›](https://github.com/paralect/pdf-service/issues?q=author%3ANesterenkoNikita "Bug reports") | [
Andrew Orsich](http://paralect.com)
[πŸ€”](#ideas-anorsich "Ideas, Planning, & Feedback") [πŸ›](https://github.com/paralect/pdf-service/issues?q=author%3Aanorsich "Bug reports") [🎨](#design-anorsich "Design") | [
Evgeny Zhivitsa](https://github.com/ezhivitsa)
[πŸ’»](https://github.com/paralect/pdf-service/commits?author=ezhivitsa "Code") [🎨](#design-ezhivitsa "Design") | [
ЖСня Π€ΠΈΠ»ΠΈΠΏΠΏΠΎΠ²ΠΈΡ‡](https://github.com/filipochka97)
[πŸ›](https://github.com/paralect/pdf-service/issues?q=author%3Afilipochka97 "Bug reports") |
| :---: | :---: | :---: | :---: | :---: | :---: |

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!