Skip to main content

Github Discord PYPI Version Build Status Black License

Provides a simple Web API to convert web pages to PDF and PNG using WeasyPrint.

Dependencies

  • Flask

  • WeasyPrint

Install

Ensure you have a complete Python 3 installation. On Debian / Ubuntu, run (as root):

apt install build-essential python3 python3-dev python3-venv

You will also have to install additional dependencies for WeasyPrint. On Debian and Ubuntu, run the following command as root:

apt install libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0

For other distributions, see the WeasyPrint installation documentation.

Then, to install Saltimbanque from PyPI, run (as root):

mkdir -p /opt/saltimbanque
python3 -m venv /opt/saltimbanque/env
/opt/saltimbanque/env/bin/pip install saltimbanque gunicorn

Alternatively, to install it from Git, run (as root):

mkdir -p /opt/saltimbanque
git clone https://github.com/wanadev/saltimbanque.git /opt/saltimbanque/saltimbanque.git
python3 -m venv /opt/saltimbanque/env
/opt/saltimbanque/env/bin/pip install gunicorn
/opt/saltimbanque/env/bin/pip install -e /opt/saltimbanque/saltimbanque.git

NOTE: If you need the export webpage to PNG, you should install an older WeasyPrint version:

/opt/saltimbanque/env/bin/pip install weasyprint==52.5

Usage

To run Saltimbanque:

/opt/saltimbanque/env/bin/gunicorn -w 4 saltimbanque:app

By default it will listen to port 8000. To run it on an other port:

/opt/saltimbanque/env/bin/gunicorn -w 4 -b 127.0.0.1:8888 saltimbanque:app

Important notes:

  • It is recommanded to use supervisor or systemd to start the Saltimbanque server.

  • You should also consider to setup a proxy server like Nginx in front of Gunicorn.

You can now open the Saltimbanque root route in your browser to access a demo web page:

API

To build a PDF from a web page:

http://localhost:8000/html-to-pdf/<string:base64_url>

To build a PNG from a web page:

http://localhost:8000/html-to-png/<string:base64_url>

Where:

  • base64_url is the URL of the HTML document, encoded in base64.

NOTE: html-to-png is no more available since WeasyPrint 53. You should install an older WeasyPrint version if you need this feature. For more information see https://www.courtbouillon.org/blog/00008-weasyprint-53-beta/ .

Contributing

Questions

If you have any question, you can:

Bugs

Please open an issue on GitHub with as much information as possible if you found a bug:

  • Your operating system / Linux distribution (and its version)

  • How you installed the software

  • All the logs and message outputted by the software

  • etc.

Pull requests

Please consider filing a bug before starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.

Please note that your code must follow the coding style defined by the pep8. Black and Flake8 are used on this project to enforce the coding style.

Lint the code

You must install Nox first:

pip install nox

Then you can check for lint error:

nox --session lint

You can also fix coding style errors automatically with:

nox -s black_fix

Setup / Run Saltimbanque for dev

Install dependencies:

python3 -m venv __env__
__env__/bin/pip install -e ".[dev]"

Run:

__env__/bin/flask run

Changelog

  • [NEXT] (changes on master, but not released yet):

    • Nothing yet ;)

  • v1.2.2:

    • misc: Replaced setup.py + setuptools by pyproject.toml + flit (@flozz)

    • misc: Added Python 3.13, 3.14 support (@flozz)

    • misc!: Removed Python 3.8, 3.9 support (@flozz)

  • v1.2.1:

    • misc: Added missing AGPL license

  • v1.2.0:

    • Fixes deployment

    • Updates dependencies

    • Adds PNG raster function in addition to PDF

  • v1.1.1: Fix encoding issue when decoding URLs

  • v1.1.0: Encode URL in base64 to avoid issue when used with an Nginx front

  • v1.0.1: Update deploy config

  • v1.0.0: Initial release

Metadata

Release files for saltimbanque 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for saltimbanque 1.2.2
File Size Uploaded
saltimbanque-1.2.2.tar.gz 15.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for saltimbanque 1.2.2
File Interpreter ABI Platform
saltimbanque-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 32.9 kB

Release files / saltimbanque-1.2.2.tar.gz

Download URL saltimbanque-1.2.2.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e06d81213eef0f3d77faf6b681e790e40023920780daf77529da19e2acef2f63
BLAKE2b-256 checksum
How to use checksums
fe9c96eb5231ebfb98466a32582cebe7c2606ceb4b2968307355a8065b2a0dbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / saltimbanque-1.2.2-py3-none-any.whl

Download URL saltimbanque-1.2.2-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43f8849de648d92f4f8c5fcea5fd04bdcaa0fe6957f65745c2f5f6e3ce641ec5
BLAKE2b-256 checksum
How to use checksums
ecf5ccc1bfc64ef2ae5e25a31fd2fe2ff1e0b2d07fcbd1f1f22b2fa81929dc94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page