A Restful API for print PDF with WeasyPrint.
Get the latest version (main branch)
docker pull ghcr.io/timfanda35/weasyprint-pdf-api:latestOr use specific version (recommended)
docker pull ghcr.io/timfanda35/weasyprint-pdf-api:1.1.1Run with default port 8000
docker run -it --rm -p 8000:8000 ghcr.io/timfanda35/weasyprint-pdf-api:latestRun with specific port, like 8080
docker run -it --rm -p 8080:8080 -e PORT=8080 ghcr.io/timfanda35/weasyprint-pdf-api:latestOpen http://localhost:8000/docs in the browser.
POST /pdfs, for example:
{ "html": "<h1>Hello World</h1>" }Response will be streaming download.
You can also specific filename:
{ "filename": "shipping-label", "html": "<h1>Hello World</h1>" }Use thg dev container with VS Code
https://vscode.com.tw/docs/devcontainers/containers
Install httpx and pytest
pip install httpx pytestRun test cases
pytest