HTML-to-PDF generation via headless Chromium with a template engine, MinIO storage, and a signed download URL API. Pass raw HTML or a registered template slug with variables — the plugin renders it, produces a PDF, stores it in MinIO, and returns a time-limited signed URL. Works for invoices, reports, contracts, certificates, and any other document that can be described in HTML/CSS.
MinIO (object storage) must be enabled for PDF storage and signed URL generation. Run nself service enable storage first.
nself service enable storage # MinIO required
nself plugin install nself-pdf
nself build
nself start| Variable | Required | Default | Description |
|---|---|---|---|
PDF_STORAGE_BUCKET | No | nself-pdfs | MinIO bucket for generated PDF files |
PDF_SIGNED_URL_TTL_SECONDS | No | 3600 | Signed URL expiry time in seconds |
PDF_PAGE_FORMAT | No | A4 | Default page size: A4, Letter, Legal |
PDF_MARGIN_MM | No | 10 | Page margin in millimetres (applied to all sides) |
PDF_TIMEOUT_SECONDS | No | 30 | Chromium render timeout per document |
PDF_RATE_RPM | No | 60 | Per-user generation requests per minute |
PDF_MAX_CONCURRENCY | No | 4 | Parallel Chromium instances for concurrent render |
# From raw HTML
curl -X POST https://api.yoursite.com/pdf/generate \
-H "Authorization: Bearer $TOKEN" \
-d '{
"html": "<h1>Invoice #1042</h1><p>Amount: $99.00</p>",
"filename": "invoice-1042.pdf"
}'
# Returns: {"url": "https://storage.yoursite.com/nself-pdfs/...", "expires_at": "..."}
# From a registered template
curl -X POST https://api.yoursite.com/pdf/generate \
-H "Authorization: Bearer $TOKEN" \
-d '{
"template_slug": "invoice",
"variables": {
"invoice_number": "1042",
"customer": "Acme Corp",
"amount": "$99.00",
"due_date": "2026-06-01"
}
}'# Register a template
curl -X POST https://api.yoursite.com/pdf/template \
-H "Authorization: Bearer $TOKEN" \
-d '{
"slug": "invoice",
"html": "<html>... {{invoice_number}} ... {{customer}} ...</html>",
"page_format": "A4",
"margin_mm": 15
}'| Endpoint | Method | Description |
|---|---|---|
/pdf/generate | POST | Generate a PDF from raw HTML or a template slug |
/pdf/template | POST | Create or update a PDF template |
/pdf/template/:slug | GET | Retrieve a template by slug |
/pdf/template/:slug | DELETE | Remove a template |
/pdf/jobs | GET | List recent generation jobs with status and output URL |
/pdf/health | GET | Chromium readiness and MinIO connectivity |
np_pdf_templates — stored templates with slug, HTML, and page settingsnp_pdf_jobs — generation job records with output key and signed URL TTLPro Plugin — ɳSelf+ | Port: 3828 | v0.1.0