maxpoletaev / pdfserver

The easiest way to generate PDF from HTML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF Server

Service that lets you create PDF documents from HTML files or webpages with Google Chrome and simple HTTP interface.

API

Start the service with Docker:

docker run -d --name pdf-service -p 8000:8000 --cap-add=SYS_ADMIN zenwalker/pdfserver

Now you can use the HTTP interface to generate PDF from any URL:

curl http://localhost:8000/?url=https://github.com -o output.pdf

Also you can pass a HTML document as a string:

curl http://localhost:8000 -d '<h1>It works!</h1>' -o output.pdf

Additional print arguments such as scale or landscape can be passed with GET parameters:

curl http://localhost:8000/?scale=2&landscape=true -d '<h1>It works!</h1>' -o output.pdf

The full list of available arguments can be found at Chrome DevTool Protocol Documentation.

Thanks pychrome for providing a great Python wrapper around Chrome DevTool API.

About

The easiest way to generate PDF from HTML


Languages

Language:Python 100.0%