---
title: "PDF-to-HTML server-side conversion"
canonical_url: "https://www.nutrient.io/guides/document-engine/conversion/pdf-to-html/"
md_url: "https://www.nutrient.io/guides/document-engine/conversion/pdf-to-html.md"
last_updated: "2026-06-04T20:13:30.215Z"
description: "Learn how to convert PDF to HTML with Document Engine, including page and reflow layouts and optional processing steps."
---

# Convert PDF to HTML

Document Engine can convert PDF documents to HTML. You can use this output for downstream processing, web display, or content reuse.

This guide explains how to convert a PDF to HTML with the [`/api/build` endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Processor/operation/build-document).

- Ensure [Document Engine is up and running](https://www.nutrient.io/sdk/document-engine/getting-started.md).

- Send a [multipart POST request](https://www.baeldung.com/postman-form-data-raw-x-www-form-urlencoded) with [instructions](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Build-API) to Document Engine’s `/api/build` endpoint.

For more information, refer to the [API reference](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Build-API) to learn about the `/api/build` endpoint and all the actions you can perform on PDFs with Document Engine.

For an overview of multipart requests, refer to the [brief tour of multipart requests](https://www.nutrient.io/blog/a-brief-tour-of-multipart-requests/) blog post.









## Basic conversion

Start with a standard Build API request.

To convert a PDF to HTML, send a PDF as input and set the output type to `html`.

### SHELL

```shell

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

```

### 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="document.pdf"
Content-Type: application/pdf

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

{
  "parts": [{ "file": "document" }],
  "output": {
    "type": "html"
  }
}
--customboundary--

```

The response is an HTML document with the `text/html` content type.

## HTML layout options

Choose a layout based on how you want the HTML to represent the source PDF.

The HTML output supports two layouts:

- `page` — Preserves the original page structure of the PDF.

- `reflow` — Produces a continuous flow of text without page breaks.

If you don’t specify a layout, Document Engine uses `page` by default.

### Page layout

Use `page` when you want the generated HTML to stay close to the original PDF page structure.

### SHELL

```shell

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

```

### Reflow layout

Use `reflow` when you want the content to read as continuous HTML instead of page-based output.

### SHELL

```shell

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

```

If your input file is hosted remotely, you can send the same request as JSON:

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -H "Content-Type: application/json" \
  -d '{
    "parts": [
      {
        "file": {
          "url": "https://www.nutrient.io/api/assets/downloads/samples/pdf/document.pdf"
        }
      }
    ],
    "output": {
      "type": "html",
      "layout": "reflow"
    }
  }' \
  -o result.html

```

## Apply operations before conversion

You can modify the document before Document Engine generates the final HTML output.

Because PDF-to-HTML conversion uses the Build API, you can apply operations such as these before conversion:

- Assemble a PDF from multiple parts.

- Rotate pages.

- Add a watermark.

- Import annotations.

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F document=@/path/to/document.pdf \
  -F instructions='{
    "parts": [{ "file": "document" }],
    "actions": [
      {
        "type": "rotatePages",
        "rotation": 90,
        "pages": {
          "start": 0,
          "end": 0
        }
      }
    ],
    "output": {
      "type": "html",
      "layout": "page"
    }
  }' \
  -o result.html

```

This approach helps you make sure the exported HTML reflects the processed document.

## API schema reference

Refer to these API reference entries for the full schema details:

- [`/api/build` endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Processor/operation/build-document)

- [`BuildInstructions` schema](https://www.nutrient.io/api/reference/document-engine/upstream/#model/BuildInstructions)

- [`HTMLOutput` schema](https://www.nutrient.io/api/reference/document-engine/upstream/#model/HTMLOutput)

## Next steps

You can now choose the layout mode that fits your use case:

- Use `page` when visual structure matters.

- Use `reflow` when you need continuous HTML output.

For related workflows, refer to the following guides:

- [Convert HTML to PDF](https://www.nutrient.io/guides/document-engine/conversion/html-to-pdf.md)

- [PDF and document conversion server](https://www.nutrient.io/guides/document-engine/conversion.md)

- [Convert PDF to image](https://www.nutrient.io/guides/document-engine/conversion/pdf-to-image.md)

- [Convert PDF to Office](https://www.nutrient.io/guides/document-engine/conversion/pdf-to-office.md)

- [Convert documents to PDF/A formats](https://www.nutrient.io/guides/document-engine/conversion/to-pdfa.md)

- [Convert PDFs to PDF/UA-1](https://www.nutrient.io/guides/document-engine/conversion/to-pdfua.md)
---

## Related pages

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

