A simple FastAPI REST application to run wkhtmltopdf.
Use the provided Dockerfile or the built image at ghcr.io/matbyte-com/htmltopdf-api.
Supported Architectures:
linux/amd64(x86_64)linux/arm64(aarch64)
Available tags:
latest- Latest build from the main brancha.b.c- Semantic version tags (e.g.,1.0.0,1.0,1)<branch>-<sha>- Branch-specific builds with git SHA<branch>- Latest build from a specific branch
All images are multi-architecture and will automatically pull the correct version for your platform.
python3 -m venv venvsource venv/bin/activatepip install -r requirements.txtpython3 main.py
Once the API is running, it can be accessed on port 9090.
Swagger docs can be found at /docs. A healthcheck endpoint is available at /healthz.
POST /v1/convert
{
"html": "<html><b>Test</b></html>",
"options": {
"grayscale": true,
...
}
}Run the test suite with pytest:
pytest -vOr run tests with coverage:
pytest --cov=main --cov-report=htmlThis project uses GitHub Actions for continuous integration and deployment:
- Python Version: 3.13
- Tests: Run automatically on every push and pull request on both AMD64 and ARM64 architectures
- Docker Images: Multi-architecture images (linux/amd64, linux/arm64) built and pushed to GitHub Container Registry only after tests pass on both architectures
- Tagging: Images are automatically tagged with:
- Git branch name
- Git SHA
- Semantic version tags in format
a.b.c(e.g.,1.0.0,1.0,1) latesttag for the default branch