HTML to PDF generation REST API
831
HTML to PDF generation REST API powered by WeasyPrint.
docker run -p 8080:8080 ogulcanaydogan/pdf-api
# Convert HTML to PDF
curl -X POST http://localhost:8080/api/html-to-pdf \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Hello World</h1>"}' \
-o output.pdf
Convert HTML string to PDF.
{
"html": "<h1>Title</h1><p>Content</p>",
"page_size": "A4",
"landscape": false,
"filename": "document.pdf"
}
Convert a URL to PDF.
{
"url": "https://example.com",
"page_size": "Letter",
"filename": "page.pdf"
}
Convert multiple documents, returns a ZIP file.
{
"documents": [
{"html": "<h1>Doc 1</h1>", "filename": "doc1.pdf"},
{"html": "<h1>Doc 2</h1>", "filename": "doc2.pdf"}
]
}
| Variable | Description | Default |
|---|---|---|
PORT | Server port | 8080 |
MAX_CONTENT_MB | Max request size in MB | 10 |
DEFAULT_PAGE_SIZE | Default page size (A4, Letter, Legal) | A4 |
services:
pdf:
image: ogulcanaydogan/pdf-api
ports:
- "8080:8080"
environment:
- DEFAULT_PAGE_SIZE=A4
- MAX_CONTENT_MB=20
MIT
Content type
Image
Digest
sha256:f1df75964…
Size
79.1 MB
Last updated
7 months ago
docker pull ogulcanaydogan/pdf-api