PDF to OFD API
Convert a PDF file to OFD by using the typed conversion route.
Feature
Request Mode
| Item | Value |
|---|---|
| Authentication | x-api-key: your_api_key_here |
| Request URL | POST http://localhost:8080/api/v1/process/pdf/ofd |
| Content type | multipart/form-data |
| Success response | OFD file stream |
Request Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
file | File | Source file. Recommended extension: .pdf. | Yes |
options | String | JSON string containing the feature options below. | No |
password | String | Source file open password, used for password-protected PDFs. | No |
Options Parameters
Put the following fields in the options JSON string.
| Parameter | Type | Purpose |
|---|---|---|
isContainImg | Integer or String | Whether to include images in the output. 0 = no, 1 = yes. |
isContainAnnot | Integer or String | Whether to include annotations in the output. 0 = no, 1 = yes. |
enableOcr | Integer or String | Whether to use OCR. 0 = disabled, 1 = enabled. |
ocrRecognitionLang | String | OCR language code. Supported values: AUTO, CHINESE, CHINESE_TRAD, ENGLISH, KOREAN, JAPANESE, LATIN, DEVANAGARI, CYRILLIC, ARABIC, TAMIL, TELUGU, KANNADA, THAI, GREEK, ESLAV. Default: AUTO. |
ocrOption | String | INVALID_CHARACTER, SCAN_PAGE, INVALID_CHARACTERAND_SCAN_PAGE, or ALL. Default: ALL. |
pageRanges | String | Page ranges to process, starting from page 1. Examples: 1, 1-3, 1,3-5. Empty means all pages. |
isOutputDocumentPerPage | Integer or String | Whether to output each page as a separate document. 0 = no, 1 = yes. |
outputFileName | String | Optional output filename. When present, it is used as the preferred download filename. |
Request Example
bash
curl -X POST "http://localhost:8080/api/v1/process/pdf/ofd" \
-H "x-api-key: your_api_key_here" \
-F "[email protected]" \
-F 'options={"isContainImg":1,"isContainAnnot":1,"enableOcr":0,"ocrRecognitionLang":"AUTO","ocrOption":"ALL","pageRanges":"","isOutputDocumentPerPage":0}'Response
On success, the API returns the converted file stream with Content-Type and Content-Disposition headers. On failure, the ComPDF Self-hosted returns a normalized error JSON response.