Document Converters
Document converters accept an uploaded file via multipart/form-data and convert it to PDF. These endpoints support a wide range of office document formats including Microsoft Office, LibreOffice, Apple iWork, and ePub.
All document conversions are powered by LibreOffice via the unoserver backend, providing high-fidelity rendering of complex documents with embedded fonts, images, charts, and formatting.
Available Endpoints
Microsoft Office
| Endpoint | Input Formats | Description |
|---|---|---|
POST /v1/convert/doc-to-pdf |
.doc, .docx |
Convert Word documents to PDF |
POST /v1/convert/excel-to-pdf |
.xlsx, .xls |
Convert Excel spreadsheets to PDF |
POST /v1/convert/ppt-to-pdf |
.ppt, .pptx |
Convert PowerPoint presentations to PDF |
LibreOffice / OpenDocument
| Endpoint | Input Formats | Description |
|---|---|---|
POST /v1/convert/odt-to-pdf |
.odt |
Convert Writer documents to PDF |
POST /v1/convert/ods-to-pdf |
.ods |
Convert Calc spreadsheets to PDF |
POST /v1/convert/odp-to-pdf |
.odp |
Convert Impress presentations to PDF |
POST /v1/convert/ots-to-pdf |
.ots |
Convert Calc spreadsheet templates to PDF |
Apple iWork
| Endpoint | Input Formats | Description |
|---|---|---|
POST /v1/convert/pages-to-pdf |
.pages |
Convert Pages documents to PDF |
POST /v1/convert/numbers-to-pdf |
.numbers |
Convert Numbers spreadsheets to PDF |
POST /v1/convert/key-to-pdf |
.key |
Convert Keynote presentations to PDF |
Other Formats
| Endpoint | Input Formats | Description |
|---|---|---|
POST /v1/convert/epub-to-pdf |
.epub |
Convert ePub ebooks to PDF |
Request Format
All document converter endpoints use multipart/form-data for the request body.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | The document file to convert. Must match the expected input format for the endpoint. |
output_filename |
string | No | Custom filename for the converted PDF. If omitted, the API generates a filename based on the input file. |
pdf_options |
string (JSON) | No | PDF output configuration as a JSON string. Controls page size, orientation, margins, and grayscale. See PDF Options. |
Examples
Convert a Word Document to PDF
curl -X POST https://api.enconvert.com/v1/convert/doc-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@report.docx"
Convert an Excel Spreadsheet to PDF
curl -X POST https://api.enconvert.com/v1/convert/excel-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@financials.xlsx" \
-F "output_filename=financials-report"
Convert a PowerPoint Presentation to PDF
curl -X POST https://api.enconvert.com/v1/convert/ppt-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@slides.pptx"
Convert an ePub to PDF with Custom Page Size
curl -X POST https://api.enconvert.com/v1/convert/epub-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@book.epub" \
-F 'pdf_options={"page_size": "A5", "margins": {"top": 20, "bottom": 20, "left": 15, "right": 15}}'
Convert an Apple Pages Document to PDF
curl -X POST https://api.enconvert.com/v1/convert/pages-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@document.pages"
PDF Options
Since document converters use multipart/form-data, the pdf_options parameter is sent as a JSON string in a form field.
Parameters
| Field | Type | Default | Description |
|---|---|---|---|
page_size |
string | "A4" |
Paper size: A0–A6, B0–B5, Letter, Legal, Tabloid, Ledger. |
page_width |
float | null |
Custom page width in mm. Overrides page_size (requires page_height). |
page_height |
float | null |
Custom page height in mm. Overrides page_size (requires page_width). |
orientation |
string | "portrait" |
"portrait" or "landscape". |
margins |
object | {"top": 10, "bottom": 10, "left": 10, "right": 10} |
Page margins in mm. |
scale |
float | 1.0 |
Scale of content rendering (0.1–2.0). |
grayscale |
boolean | false |
Convert output to grayscale. |
header |
object | null |
Header on each page. |
header.content |
string | "" |
Text content with template variables: {{page}}, {{total_pages}}, {{date}}. |
header.height |
float | 15 |
Header area height in mm. |
footer |
object | null |
Footer on each page. |
footer.content |
string | "" |
Text content with template variables. |
footer.height |
float | 15 |
Footer area height in mm. |
Template Variables
| Variable | Description |
|---|---|
{{page}} |
Current page number |
{{total_pages}} |
Total number of pages |
{{date}} |
Formatted current date |
Example: Word Document with Landscape Orientation and Page Numbers
curl -X POST https://api.enconvert.com/v1/convert/doc-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@report.docx" \
-F 'pdf_options={"page_size": "Letter", "orientation": "landscape", "footer": {"content": "Page {{page}} of {{total_pages}}", "height": 12}}'
Example: Excel Spreadsheet in Grayscale
curl -X POST https://api.enconvert.com/v1/convert/excel-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@data.xlsx" \
-F 'pdf_options={"page_size": "A3", "orientation": "landscape", "grayscale": true}'
See Parameters & Options for the full PDF options reference.
Response Formats
The response format depends on the type of API key used to authenticate the request.
Response with Private API Key
When authenticated with a private API key, the API returns a JSON response containing a presigned URL for downloading the converted file and the storage object key.
HTTP 200 OK
{
"success": true,
"message": "Conversion successful",
"presigned_url": "https://storage.enconvert.com/live/files/abc123/doc-to-pdf/report_20260311_143022456.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...",
"object_key": "live/files/abc123/doc-to-pdf/report_20260311_143022456.pdf",
"filename": "report_20260311_143022456.pdf",
"file_size": 156432,
"conversion_time": 2.847
}
| Field | Type | Description |
|---|---|---|
success |
boolean | Whether the conversion succeeded. |
message |
string | Human-readable status message. |
presigned_url |
string | A temporary, downloadable URL for the converted file. |
object_key |
string | The storage path of the converted file (e.g., live/files/{key_id}/{conversion_type}/...). |
filename |
string | The name of the converted file. |
file_size |
integer | Size of the converted file in bytes. |
conversion_time |
float | Time taken for the conversion in seconds. |
Response with Public API Key or JWT
When authenticated with a public API key or a JWT token, the API returns the converted file directly as a binary download.
HTTP 200 OK
The response body contains the raw PDF content with the appropriate Content-Type header.
Response Headers
| Header | Description | Example |
|---|---|---|
Content-Disposition |
Indicates the filename for the downloaded file. | attachment; filename="report_20260311_143022456.pdf" |
Content-Type |
MIME type of the converted file. | application/pdf |
X-Object-Key |
The storage path of the converted file. | live/files/abc123/doc-to-pdf/report_20260311_143022456.pdf |
X-File-Size |
Size of the converted file in bytes. | 156432 |
X-Conversion-Time |
Time taken for the conversion in seconds. | 2.847 |
X-Filename |
The name of the converted file. | report_20260311_143022456.pdf |
Error Responses
Validation Error (400)
Returned when the uploaded file is missing or invalid.
{
"success": false,
"error": "No file provided",
"code": "MISSING_FILE"
}
Unsupported Format (400)
Returned when the file type does not match the expected input format.
{
"success": false,
"error": "Invalid file format. Expected DOCX or DOC file.",
"code": "INVALID_FORMAT"
}
Conversion Failure (500)
Returned when the document conversion engine fails to process the file.
{
"success": false,
"error": "Document Conversion Failed: unable to process the file",
"code": "CONVERSION_ERROR"
}
Supported Format Reference
| Endpoint | Accepted Extensions | Format Type |
|---|---|---|
doc-to-pdf |
.doc, .docx |
Microsoft Word |
excel-to-pdf |
.xlsx, .xls |
Microsoft Excel |
ppt-to-pdf |
.ppt, .pptx |
Microsoft PowerPoint |
odt-to-pdf |
.odt |
OpenDocument Text |
ods-to-pdf |
.ods |
OpenDocument Spreadsheet |
odp-to-pdf |
.odp |
OpenDocument Presentation |
ots-to-pdf |
.ots |
OpenDocument Spreadsheet Template |
pages-to-pdf |
.pages |
Apple Pages |
numbers-to-pdf |
.numbers |
Apple Numbers |
key-to-pdf |
.key |
Apple Keynote |
epub-to-pdf |
.epub |
ePub Ebook |