A Restful API for print PDF with WeasyPrint.
docker pull ghcr.io/timfanda35/weasyprint-pdf-api:latest
Or use specific version
docker pull ghcr.io/timfanda35/weasyprint-pdf-api:1.0.0
Run with default port 8000
docker run -it --rm -p 8000:8000 ghcr.io/timfanda35/weasyprint-pdf-api:latest
Run with specific port, like 8080
docker run -it --rm -p 8080:8080 -e PORT=8080 ghcr.io/timfanda35/weasyprint-pdf-api:latest
Open 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>" }make buildIt create a container and bind port 8000.
make dev-consoleuvicorn main:app --reload --host 0.0.0.0Install httpx and pytest
pip install httpx pytest
Run test cases
pytest