Office-to-PDF API
Use the Office-to-PDF API to convert Office documents (DOC, DOCX, XLS, XLSX, PPT, and PPTX) to PDF. For an overview of signup, pricing, and conversion examples by file type, refer to the Office-to-PDF API task page.
Convert an Office file to PDF
Add an Office file (for example, document.docx) in the same folder as your code, and send it to the /build endpoint:
curl -X POST https://api.nutrient.io/build \ -H "Authorization: Bearer your_api_key_here" \ -F 'document=@document.docx' \ -F 'instructions={ "parts": [ { "file": "document" } ] }' \ --fail \ -o result.pdfPOST https://api.nutrient.io/build HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="instructions"Content-Type: application/json
{ "parts": [ { "file": "document" } ]}--customboundaryContent-Disposition: form-data; name="document"; filename="document.docx"Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
<DOCX data>--customboundary--Convert an Office file from a URL
For remotely hosted source files, pass the URL in parts[].file.url:
{ "parts": [ { "file": { "url": "https://www.nutrient.io/downloads/examples/paper.docx" } } ]}Conversion parameters
Customize conversion behavior by adding parameters to each parts item.
In this guide, conversion parameters are shown for the
/buildFilePartschema.If you need advanced Office conversion options, use the
Build documentendpoint. The convenience endpoint/processor/convert_to_pdf(Convert to PDFin API reference) doesn’t expose allFilePartoptions.
markup_mode
markup_mode controls how markup (comments and tracked changes) is preserved during Word document conversion.
- Applicable to — Word documents (
.docx) - Supported values —
noMarkup(default) — Render the document as if all changes were acceptedoriginal— Render the document as if all changes were rejectedsimpleMarkup— Render with changes accepted and comments as annotationsallMarkup— Render with all markups visible, including redlines and comments
- Default —
noMarkup
half_transparent_header_footer
half_transparent_header_footer renders headers and footers as half-transparent in the converted PDF.
- Available via —
/buildonly - Not exposed by —
/processor/convert_to_pdf - Applicable to — Word documents (
.doc,.docx,.odt,.rtf) - Supported values —
true,false - Default —
false
render_only_print_area
render_only_print_area controls spreadsheet output scope.
- Available via —
/buildonly - Not exposed by —
/processor/convert_to_pdf - Applicable to — Spreadsheet documents (
.xls,.xlsx) - Supported values —
false(default) — Render full sheet contenttrue— Render only the defined print area (falls back to full sheet if no print area is defined)
Example with conversion parameters
{ "parts": [ { "file": "document", "markup_mode": "allMarkup", "half_transparent_header_footer": true, "render_only_print_area": true } ]}Related API reference operations
Convert to PDFconvenience endpoint — Higher-level endpoint with a limited parameter surface.Build documentendpoint — Complete control, including advanced Office conversion parameters.