Sign inSign up

venlentine/urltopdf

By venlentine

•Updated almost 2 years ago

Converts any URL or HTML content to a PDF file or an image (PNG/JPEG)

Image
API management
0

99

venlentine/urltopdf repository overview

⁠URL to PDF Microservice Docker Image

Logo Web page PDF rendering done right. Microservice for rendering receipts, invoices, or any content. Packaged to an easy API.

⚠️ WARNING ⚠️ *Don't serve this API publicly to the internet unless you are aware of the risks. It allows API users to run any JavaScript code inside a Chrome session on the server.It's fairly easy to expose the contents of files on the server. You have been warned!.

⁠Feature

  • Converts any URL or HTML content to a PDF file or an image (PNG/JPEG)
  • Rendered with Headless Chrome, using Puppeteer⁠. The PDFs should match to the ones generated with a desktop Chrome.
  • Sensible defaults but everything is configurable.
  • Single-page app (SPA) support. Waits until all network requests are finished before rendering.
  • Easy deployment to Heroku. We love Lambda but...Deploy to Heroku button.
  • Renders lazy loaded elements. (scrollPage option)
  • Supports optional x-api-key authentication. (API_TOKENS env var)

Usage is as simple as http://192.168.32.197:2090/api/render?url=http://google.com⁠. There's also a POST /api/render if you prefer to send options in the body.

⁠Usage

sudo docker run -d --name urltopdf \
    -p 2090:9000 \
    -m 500M --memory-swap=550M \
    --restart=always \
    -e ALLOW_HTTP=true \
    -e DEBUG_MODE=false \
    -e DISABLE_HTML_INPUT=false \
    -e API_TOKENS=123456 \
    venlentine/urltopdf:v1.0.0

⁠Configuration

Environment variables:

NameDefaultAcceptedDescription
DEBUG_MODEfalse
ALLOW_HTTPfalse
DISABLE_HTML_INPUTfalse
API_TOKENSx-api-key

⁠Tips

...

⁠Credits

Tag summary

Content type

Image

Digest

sha256:2b69d4f95…

Size

451.1 MB

Last updated

almost 2 years ago

docker pull venlentine/urltopdf:v1.0.0