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.
Merge multiple PDF files into one PDF in upload order.
The ComPDF Self-hosted accepts files and a request JSON string through multipart/form-data, forwards the parameters to the private PDF SDK, and streams the result file back on success.
| Item | Value |
|---|---|
| Authentication | x-api-key: your_api_key_here |
| Request URL | POST http://localhost:8080/api/v1/process/pdf/merge |
| Content type | multipart/form-data |
| Success response | Result file stream |
| Parameter | Type | Description | Required |
|---|---|---|---|
files | File[] | PDF files to merge. Use one files form-data part per input file. | Yes |
request | String | JSON string containing the PDF SDK parameters below. If omitted, remaining non-file form-data fields are forwarded as the request object. | No |
Put the following fields in the request JSON string.
| Parameter | Type | Purpose |
|---|---|---|
pageRanges | String | Page ranges to process, starting from page 1. Examples: 1, 1-3, 1,3-5. Empty means all pages. |
passwords | Array | Per-file password list for merge. Use null or empty string for files without a password. |
outputFileName | String | Optional output filename. When present, it is used as the preferred download filename. |
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"],"passwords":[null]}'On success, the API returns the processed file stream with Content-Type and Content-Disposition headers. On failure, ComPDF Self-hosted returns the normalized error response described in Definition of Error Codes, including type, code, errorCode, message, and traceId.