Skip to main content

Render html to pdf with weasyprint, controled from stdin

Project description

WeasyPrint Daemon

Protocol

start header

On startup, wpd sends a header to stdout, always on a single line:

{"wpd": "<implementation name>", "version": "<version>", "protocol": "1"}\n

job submission

job submission, to stdin:

{"id": "xxx", "css": "css content", "size": <html content size>}\n
html content\n

The json header must be on one line.

cancel job

{"id": "xxx", "action": "cancel"}\n

The job may be canceled by the renderer, but may also be rendered and returned.

get results

result retrieval, from stdout:

{"id": "xxx", "size": <file size>}\n
PDF content\n

The json header will always be on one line.

Any error will be reported as following:

{"id": "xxx", "error": ""}

stopping

To stop the daemon, just close stdin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WPD-0.1.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

WPD-0.1.1-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page