PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDF Self-hosted exposes file processing APIs under /api/v1. Protected file processing APIs require the x-api-key request header.
| Type | Endpoint | Success Response |
|---|---|---|
| Synchronous conversion | POST /api/v1/process/{source}/{target} | Result file stream |
| Synchronous PDF tools | POST /api/v1/process/pdf/{operation} | Result file stream |
| Synchronous PDF generation | POST /api/v1/process/pdf/generation/{operation} | Result PDF stream |
| Async task creation | POST /api/v1/task/{source}/{target} | JSON envelope with taskId and status |
| Task status | GET /api/v1/task/{id} | JSON envelope with task information |
| Task result download | GET /api/v1/task/{id}/download | Result file stream |
Synchronous PDF to Word:
curl -X POST "http://localhost:8080/api/v1/process/pdf/docx" \
-H "x-api-key: your_api_key_here" \
-F "[email protected]" \
-F 'options={"pageRanges":"1-3"}' \
-o result.docxSynchronous PDF merge:
curl -X POST "http://localhost:8080/api/v1/process/pdf/merge" \
-H "x-api-key: your_api_key_here" \
-F "[email protected]" \
-F "[email protected]" \
-F 'request={"pageRanges":["all","all"]}' \
-o merged.pdfCreate an async task:
curl -X POST "http://localhost:8080/api/v1/task/pdf/docx" \
-H "x-api-key: your_api_key_here" \
-F "[email protected]" \
-F 'options={"pageRanges":"1-3"}'Async creation and task query APIs return a JSON envelope:
{
"code": 200,
"msg": "success",
"data": {
"taskId": "7fdc1fb6-1f4d-4b5c-88d6-4b4c4c1e8f44",
"status": "pending"
}
}Synchronous result APIs return a binary stream with Content-Type and Content-Disposition headers.