Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xjodoin/htmlpdfconverter
HTML to PDF rendering microservice. Easy Kubernetes deploy to support beautiful pdf rendering or use it with the self-hosted UI version.
https://github.com/xjodoin/htmlpdfconverter
converter html pdf rest-api
Last synced: about 11 hours ago
JSON representation
HTML to PDF rendering microservice. Easy Kubernetes deploy to support beautiful pdf rendering or use it with the self-hosted UI version.
- Host: GitHub
- URL: https://github.com/xjodoin/htmlpdfconverter
- Owner: xjodoin
- License: apache-2.0
- Created: 2021-01-21T19:08:44.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-19T18:43:06.000Z (almost 4 years ago)
- Last Synced: 2024-12-03T17:53:13.506Z (about 2 months ago)
- Topics: converter, html, pdf, rest-api
- Language: JavaScript
- Homepage: https://htmlpdfconverter.com
- Size: 313 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTML to PDF Microservice
> Web page PDF rendering done right. Microservice for rendering receipts, invoices, or any content.
**Features:**
* Web interface to generate PDF render
* Converts any URL or HTML content to a PDF file
* Rendered with Headless Chrome, using [Puppeteer](https://github.com/GoogleChrome/puppeteer). The PDFs should match to the ones generated with a desktop Chrome.
* Single-page app (SPA) support. Waits until all network requests are finished before rendering.
* Easy deployment to Kubernetes or any docker runtime.Usage is as simple as [https://htlmpdfconverter.com?url=https://google.com](https://htlmpdfconverter.com?url=https://google.com). There's also a `POST /api/render` if you prefer to send options in the body.
**Why?**
This microservice is useful when you need to automatically produce PDF files
for whatever reason. The files could be receipts, weekly reports, invoices,
or any content.PDFs can be generated in many ways, but one of them is to convert HTML+CSS
content to a PDF. This API does just that.### Good to know
* **By default, page's `@media print` CSS rules are ignored**. We set Chrome to emulate `@media screen` to make the default PDFs look more like actual sites.
* Chrome is launched with `--no-sandbox --disable-setuid-sandbox` flags to fix usage in Heroku. See [this issue](https://github.com/GoogleChrome/puppeteer/issues/290).
* Heavy pages may cause Chrome to crash if the server doesn't have enough RAM.
* Docker image for this can be found here: https://hub.docker.com/repository/docker/xjodoin/htmlpdfconverter
## Examples
Try it [online](https://htmlpdfconverter.com)
Licensing
=========
htmlpdfconverter is licensed under the Apache License, Version 2.0. See
[LICENSE](https://github.com/xjodoin/htmlpdfconverter/blob/master/LICENSE) for the full
license text.