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.
Before you start
Prepare your account, API key, and source file:
- Create a Processor API account(opens in a new tab) or sign in to your existing account.
- Open the API keys page(opens in a new tab).
- Copy a live key with Processor API access.
- Replace the API key placeholder in the example with your key.
- Save a representative Office file in the same folder as your code.
Use fictional data to test the setup.
Keep your API key on the backend. Don’t include it in browser code or commit it to source control. For account setup and free-plan output restrictions, refer to the getting started guide.
Convert an Office file to PDF
Send the Office file to the /build endpoint. These examples use document.docx from the same folder as your code:
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.
This guide uses the
/buildFilePartschema for conversion parameters.For advanced Office conversion options, use the build document endpoint. The
/processor/convert_to_pdfconvenience endpoint doesn’t expose allFilePartoptions. The API reference lists this endpoint as convert to PDF.
markup_mode
markup_mode controls how the API renders comments and tracked changes when converting Word documents.
- Applicable to — Word documents (
.docx) - Supported values —
- Render the document with all changes accepted —
noMarkup(default). - Render the document with all changes rejected —
original. - Render accepted changes and comments as annotations —
simpleMarkup. - Render all markup, including redlines and comments —
allMarkup.
- Render the document with all changes accepted —
- Default —
noMarkup
half_transparent_header_footer
half_transparent_header_footer controls whether the API 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 whether the API renders the full spreadsheet content or only the defined print area.
- Available via —
/buildonly - Not exposed by —
/processor/convert_to_pdf - Applicable to — Spreadsheet documents (
.xls,.xlsx) - Supported values —
- Render the full sheet content —
false(default). - Render only the defined print area —
true.
- Render the full sheet content —
If the spreadsheet has no defined print area, the API renders the full sheet even when render_only_print_area is true.
Example with conversion parameters
Add conversion parameters alongside file in a parts item:
{ "parts": [ { "file": "document", "markup_mode": "allMarkup", "half_transparent_header_footer": true, "render_only_print_area": true } ]}Check the converted PDF
Open the converted PDF beside the source file before using it in a larger workflow. Check the output for your document type:
- Word — Compare page breaks, headers, footers, tables, and text layout. Check that tracked changes and comments match the selected
markup_mode. - Excel — Check sheet content, page breaks, and print areas. Confirm that
render_only_print_areaproduces the full sheet or defined print area as required. - PowerPoint — Compare slide layout, text wrapping, and image placement.
Repeat these checks with representative files before automating a batch. A successful API response alone doesn’t establish that the PDF meets your layout requirements.
Related API reference operations
Use these references to compare endpoint options:
- Convert to PDF convenience endpoint — Supports fewer conversion parameters than
/build. - Build document endpoint — Supports advanced Office conversion parameters.