---
title: "Convert MS Office files to PDF with Document Engine"
canonical_url: "https://www.nutrient.io/guides/document-engine/conversion/office-to-pdf/"
md_url: "https://www.nutrient.io/guides/document-engine/conversion/office-to-pdf.md"
last_updated: "2026-05-19T08:53:03.384Z"
description: "Learn how to convert Microsoft Office files to PDF using Document Engine’s API. Includes examples for disk and URL sources with markup mode options."
---

# Convert Office files to PDF

This guide explains how to convert Office files to PDF using Document Engine.

## Requirements

Ensure Document Engine is up and running. If you haven’t set it up yet, refer to our [getting started](https://www.nutrient.io/sdk/document-engine/getting-started.md) guides, select the deployment option you prefer, and follow the instructions.

## Converting an Office file from disk

To convert an Office file from disk, send a request to the [`/api/build` endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Document-Editing/operation/build-document), including both the Office file as input and the [`instructions` JSON](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Build-API/Instructions-Schema).

> The default output from the `/api/build` endpoint is a PDF file. You can also specify other file types. Learn more about the output options in our [API reference](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Document-Editing/operation/build-document).

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F 'document=@/path/to/example-document.docx' \
  -F instructions='{
  "parts": [
    {
      "file": "document"
    }
  ]
}' \
  -o result.pdf

```

### HTTP

```http

POST /api/build HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token=<API token>

--customboundary
Content-Disposition: form-data; name="document"; filename="example-document.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

<DOCX data>
--customboundary
Content-Disposition: form-data; name="instructions"
Content-Type: application/json

{
  "parts": [
    {
      "file": "document"
    }
  ]
}
--customboundary--

```

## Converting an Office file from URL

To convert an Office file from a URL, send a multipart request to the [`/api/build` endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Document-Editing/operation/build-document), attaching a URL pointing to the Office file:

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F instructions='{
  "parts": [
    {
      "file": {
        "url": "https://www.nutrient.io/downloads/examples/paper.docx"
      }
    }
  ]
}' \
  -o result.pdf

```

### HTTP

```http

POST /api/build HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token=<API token>

--customboundary
Content-Disposition: form-data; name="instructions"
Content-Type: application/json

{
  "parts": [
    {
      "file": {
        "url": "https://www.nutrient.io/downloads/examples/paper.docx"
      }
    }
  ]
}
--customboundary--

```

## Conversion parameters

You can customize Office file conversion by adding parameters to the `parts` object. These parameters work with both disk-based and URL-based conversions.

### Available parameters

#### markup_mode

Controls how markup (comments, 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 accepted
  - `original` — Render the document as if all changes were rejected
  - `simpleMarkup` — Render with changes accepted and comments as annotations
  - `allMarkup` — Render with all markups visible, including redlines and comments

- **Default**: `noMarkup`

- **Global configuration**: Set the `DOCX_MARKUP_MODE` environment variable to change the default value

#### half_transparent_header_footer

Renders headers and footers as half-transparent in the converted PDF.

- **Applicable to**: Word documents (`.doc`, `.docx`, `.odt`, `.rtf`)

- **Supported values**: `true`, `false`

- **Default**: `false`

- **Global configuration**: Set the `HALF_TRANSPARENT_HEADER_FOOTER` environment variable to change the default value

### Example with conversion parameters

The following example demonstrates using conversion parameters. You can combine multiple parameters in a single request:

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F 'document=@/path/to/example-document.docx' \
  -F instructions='{
  "parts": [
    {
      "file": "document",
      "markup_mode": "allMarkup",
      "half_transparent_header_footer": true
    }
  ]
}' \
  -o result.pdf

```

### HTTP

```http

POST /api/build HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token=<API token>

--customboundary
Content-Disposition: form-data; name="document"; filename="example-document.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

<DOCX data>
--customboundary
Content-Disposition: form-data; name="instructions"
Content-Type: application/json

{
  "parts": [
    {
      "file": "document",
      "markup_mode": "allMarkup",
      "half_transparent_header_footer": true
    }
  ]
}
--customboundary--

```

## Converting spreadsheets

When converting spreadsheet files (such as XLSX or XLS), you can control whether to render the entire spreadsheet content or only the defined print area using the `render_only_print_area` parameter.

This Boolean parameter accepts the following values:

- `false` — Render the entire spreadsheet content (default).

- `true` — Render only the defined print area. If no print area is defined, the entire sheet will be rendered.

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F 'document=@/path/to/spreadsheet.xlsx' \
  -F instructions='{
  "parts": [
    {
      "file": "document",
      "render_only_print_area": true
    }
  ]
}' \
  -o result.pdf

```

### HTTP

```http

POST /api/build HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token=<API token>

--customboundary
Content-Disposition: form-data; name="document"; filename="spreadsheet.xlsx"
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

<XLSX data>
--customboundary
Content-Disposition: form-data; name="instructions"
Content-Type: application/json

{
  "parts": [
    {
      "file": "document",
      "render_only_print_area": true
    }
  ]
}
--customboundary--

```
---

## Related pages

- [Convert CAD files to PDF](/guides/document-engine/conversion/cad-to-pdf.md)
- [PDF and document conversion server](/guides/document-engine/conversion.md)
- [Convert HTML to PDF](/guides/document-engine/conversion/html-to-pdf.md)
- [Convert image files to PDF](/guides/document-engine/conversion/image-to-pdf.md)
- [Convert PDF to Office](/guides/document-engine/conversion/pdf-to-office.md)
- [Convert text files to PDF](/guides/document-engine/conversion/text-to-pdf.md)
- [PDF to Excel](/guides/document-engine/conversion/pdf-to-excel.md)
- [Convert PDFs to PDF/UA-1](/guides/document-engine/conversion/to-pdfua.md)
- [Convert MS Office documents to image files](/guides/document-engine/conversion/office-to-image.md)
- [Easily convert documents to PDF/A formats](/guides/document-engine/conversion/to-pdfa.md)
- [Convert PDF to image](/guides/document-engine/conversion/pdf-to-image.md)

