pdf-service
pdf-service copied to clipboard
A docker based service for pdf and image generation
:scroll: PDF Service

CLIENT API | SERVER API | CONTRIBUTING
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('<body><h1>Hello, {{name}}!</h1></body>', {
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 and server side) and examples to learn more.
Change Log
This project adheres to Semantic Versioning. Every release is documented on the Github Releases page.
License
Ship is released under the MIT License.
Contributing
Please read 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):
KuhArt π» π π |
Uladzimir Mitskevich π€ π |
NesterenkoNikita π€ π |
Andrew Orsich π€ π π¨ |
Evgeny Zhivitsa π» π¨ |
ΠΠ΅Π½Ρ Π€ΠΈΠ»ΠΈΠΏΠΏΠΎΠ²ΠΈΡ π |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!