> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/conversion/convert-pdf-to-html.md).

# Convert PDF to HTML on Server/Desktop

To convert PDF Documents to HTML format with Apryse Server SDK.  Samples offered in Python, Java, C#, .NET, node.js (JavaScript), PHP, Ruby, C++, Go, VB; for Mac, Linux and Windows systems.

There are two HTML conversion modules.

[Fixed position](#convert-with-fixed-positioning) The built-in HTML module is used to convert PDF documents to fixed-position HTML documents.

[Full reflow](#convert-with-full-reflow) To convert PDF Documents to HTML format with full reflow. This module is an optional add-on.

## Convert with fixed positioning

To convert PDF Documents to HTML format with fixed positioning.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.ToHtml(filename, output_filename);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert::ToHtml(filename, output_filename);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
// Convert PDF document to HTML with fixed positioning option turned on (default)
ConvertToHtml(filename, output_filename)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.toHtml(filename, output_filename);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  // Convert PDF document to HTML with fixed positioning option turned on (default)
  await PDFNet.Convert.fileToHtml(filename, output_filename);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.toHtml(filename, output_filename)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// Convert PDF document to HTML with fixed positioning option turned on (default)
[PTConvert ToHtmlWithFilename:filename out_filename:output_filename options:nil];
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert::ToHtml($filename, $output_filename);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
# Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.ToHtml(filename, output_filename)
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.toHtml(withFilename:filename, out_filename:output_filename options:nil);
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
# Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.toHtml(filename, output_filename)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
' Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.ToHtml(filename, output_filename)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[PDF Converter (SVG, XPS, TIFF, JPG, RTF, TXT, More)](/core/get-started/samples/converttest.md) Full sample code which shows how to use PDFNet Convert for direct, high-quality conversion between PDF, XPS, EMF, SVG, TIFF, PNG, JPEG, and other image formats. Samples provided in Python, C#, C++, Java, node.js (JavaScript), Go, PHP, VB, Objective-C, Swift and Kotlin.

## Convert with full reflow

To convert PDF Documents to HTML format with full reflow.

{% hint style="warning" %}
**The Structured Output module is an optional add-on**

Only available on Desktop and Server (Windows, Linux, or Mac) You can find more details about how to [install the Structured Output module](/core/learn-more/modules.md#structured-output-module).
{% endhint %}

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
Convert.HTMLOutputOptions htmlOutputOptions = new Convert.HTMLOutputOptions();
// Set e_reflow_full content reflow setting
htmlOutputOptions.SetContentReflowSetting(Convert.HTMLOutputOptions.ContentReflowSetting.e_reflow_full);
// Convert PDF document to HTML with full reflow option turned on
// But requires the Structured Output module
Convert.ToHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
Convert::HTMLOutputOptions htmlOutputOptions;
// Set e_reflow_full content reflow setting
htmlOutputOptions.SetContentReflowSetting(Convert::HTMLOutputOptions::e_reflow_full);
// Convert PDF document to HTML with full reflow option turned on
// But requires the Structured Output module
Convert::ToHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
htmlOutputOptions := NewHTMLOutputOptions()
// Set e_reflow_full content reflow setting
htmlOutputOptions.SetContentReflowSetting(HTMLOutputOptionsE_reflow_full);
// Convert PDF document to HTML with full reflow option turned on
// But requires the Structured Output module
ConvertToHtml(filename, output_filename, htmlOutputOptions)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Convert.HTMLOutputOptions htmlOutputOptions = new Convert.HTMLOutputOptions();
// Set e_reflow_full content reflow setting
htmlOutputOptions.setContentReflowSetting(Convert.HTMLOutputOptions.e_reflow_full);
// Convert PDF document to HTML with full reflow option turned on
// But requires the Structured Output module
Convert.toHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const htmlOutputOptions = new PDFNet.Convert.HTMLOutputOptions();
  // Set e_reflow_full content reflow setting
  htmlOutputOptions.setContentReflowSetting(PDFNet.Convert.HTMLOutputOptions.ContentReflowSetting.e_reflow_full);
  // Convert PDF document to HTML with full reflow option turned on
  // But requires the Structured Output module
  await PDFNet.Convert.fileToHtml(filename, output_filename, htmlOutputOptions);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$htmlOutputOptions = new HTMLOutputOptions();
// Set e_reflow_full content reflow setting
$htmlOutputOptions->SetContentReflowSetting(HTMLOutputOptions::e_reflow_full);
// Convert PDF document to HTML with full reflow option turned on
// But requires the Structured Output module
Convert::ToHtml($filename, $output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
htmlOutputOptions = HTMLOutputOptions()
# Set e_reflow_full content reflow setting
htmlOutputOptions.SetContentReflowSetting(HTMLOutputOptions.e_reflow_full)
# Convert PDF document to HTML with full reflow option turned on
# But requires the Structured Output module
Convert.ToHtml(filename, output_filename, htmlOutputOptions)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
$htmlOutputOptions = Convert::HTMLOutputOptions.new()
# Set e_reflow_full content reflow setting
$htmlOutputOptions.SetContentReflowSetting(Convert::HTMLOutputOptions::E_reflow_full)
# Convert PDF document to HTML with full reflow option turned on
# But requires the Structured Output module
Convert.toHtml(filename, output_filename, $htmlOutputOptions)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim htmlOutputOptions As pdftron.PDF.Convert.HTMLOutputOptions = New pdftron.PDF.Convert.HTMLOutputOptions()
' Set e_reflow_full content reflow setting
htmlOutputOptions.SetContentReflowSetting(pdftron.PDF.Convert.HTMLOutputOptions.ContentReflowSetting.e_reflow_full)
' Convert PDF document to HTML with full reflow option turned on
' But requires the Structured Output module
Convert.ToHtml(filename, output_filename, htmlOutputOptions)
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Convert with reflow paragraphs (deprecated)

To convert PDF Documents to HTML format with reflow paragraphs.

{% hint style="warning" %}
**The HTML reflow paragraphs module is an optional add-on**

Only available on Desktop and Server (Windows, Linux, or Mac) You can find more details about how to install PDF2HTML reflow paragraph module [here ](/core/learn-more/modules.md#pdf2html-reflow-paragraph-module).
{% endhint %}

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
Convert.HTMLOutputOptions htmlOutputOptions = new Convert.HTMLOutputOptions();
// Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.SetContentReflowSetting(Convert.HTMLOutputOptions.ContentReflowSetting.e_reflow_paragraphs);
// Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.SetNoPageWidth(true);
// Convert PDF document to HTML with reflow paragraphs option turned on
// But requires the PDF2HtmlReflowParagraphsModule
Convert.ToHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
Convert::HTMLOutputOptions htmlOutputOptions;
// Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.SetContentReflowSetting(Convert::HTMLOutputOptions::e_reflow_paragraphs);
// Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.SetNoPageWidth(true);
// Convert PDF document to HTML with reflow paragraphs option turned on
// But requires the PDF2HtmlReflowParagraphsModule
Convert::ToHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
htmlOutputOptions := NewHTMLOutputOptions()
// Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.SetContentReflowSetting(HTMLOutputOptionsE_reflow_paragraphs);
// Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.SetNoPageWidth(true);
// Convert PDF document to HTML with reflow paragraphs option turned on
// But requires the PDF2HtmlReflowParagraphsModule
ConvertToHtml(filename, output_filename, htmlOutputOptions)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Convert.HTMLOutputOptions htmlOutputOptions = new Convert.HTMLOutputOptions();
// Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.setContentReflowSetting(Convert.HTMLOutputOptions.e_reflow_paragraphs);
// Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.setNoPageWidth(true);
// Convert PDF document to HTML with reflow paragraphs option turned on
// But requires the PDF2HtmlReflowParagraphsModule
Convert.toHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
Convert.HTMLOutputOptions htmlOutputOptions = new Convert.HTMLOutputOptions();
// Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.setContentReflowSetting(Convert.HTMLOutputOptions.e_reflow_paragraphs);
// Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.setNoPageWidth(true);
// Convert PDF document to HTML with reflow paragraphs option turned on
// But requires the PDF2HtmlReflowParagraphsModule
Convert.toHtml(filename, output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$htmlOutputOptions = new HTMLOutputOptions();
// Set e_reflow_paragraphs content reflow setting
$htmlOutputOptions->SetContentReflowSetting(HTMLOutputOptions::e_reflow_paragraphs);
// Optionally set to flow paragraphs across the entire browser window.
$htmlOutputOptions->SetNoPageWidth(true);
// Convert PDF document to HTML with reflow paragraphs option turned on
// But requires the PDF2HtmlReflowParagraphsModule
Convert::ToHtml($filename, $output_filename, htmlOutputOptions);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
htmlOutputOptions = HTMLOutputOptions()
# Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.SetContentReflowSetting(HTMLOutputOptions.e_reflow_paragraphs)
# Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.SetNoPageWidth(True)
# Convert PDF document to HTML with reflow paragraphs option turned on
# But requires the PDF2HtmlReflowParagraphsModule
Convert.ToHtml(filename, output_filename, htmlOutputOptions)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
$htmlOutputOptions = Convert::HTMLOutputOptions.new()
# Set e_reflow_paragraphs content reflow setting
$htmlOutputOptions.SetContentReflowSetting(Convert::HTMLOutputOptions::E_reflow_paragraphs)
# Optionally set to flow paragraphs across the entire browser window.
$htmlOutputOptions.SetNoPageWidth(true)
# Convert PDF document to HTML with reflow paragraphs option turned on
# But requires the PDF2HtmlReflowParagraphsModule
Convert.toHtml(filename, output_filename, $htmlOutputOptions)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim htmlOutputOptions As pdftron.PDF.Convert.HTMLOutputOptions = New pdftron.PDF.Convert.HTMLOutputOptions()
' Set e_reflow_paragraphs content reflow setting
htmlOutputOptions.SetContentReflowSetting(pdftron.PDF.Convert.HTMLOutputOptions.ContentReflowSetting.e_reflow_paragraphs)
' Optionally set to flow paragraphs across the entire browser window.
htmlOutputOptions.SetNoPageWidth(True)
' Convert PDF document to HTML with reflow paragraphs option turned on
' But requires the PDF2HtmlReflowParagraphsModule
Convert.ToHtml(filename, output_filename, htmlOutputOptions)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Convert PDF to HTML - Sample Code](/core/get-started/samples/pdf2htmltest.md) Full sample code which shows how to convert generic PDF documents to HTML format. Sample code provided in Python, C++, C#, Java, Node.js (JavaScript), PHP, Ruby, Go and VB.

## HTMLOutputOptions

The following table illustrates which options apply to which conversion engines.

| Settings API                    | Fixed Position | Reflow Paragraphs (Deprecated) | Full Reflow |
| ------------------------------- | -------------- | ------------------------------ | ----------- |
| SetContentReflowSetting         | X              | X                              | X           |
| SetDPI                          | X              |                                |             |
| SetExternalLinks                | X              |                                |             |
| SetInternalLinks                | X              |                                |             |
| SetMaximumImagePixels           | X              |                                |             |
| SetReportFile                   | X              |                                |             |
| SetScale                        | X              |                                |             |
| SetSimplifyText                 | X              |                                |             |
| SetJPGQuality                   | X              | X                              |             |
| SetPreferJPG                    | X              | X                              |             |
| SetDisableVerticalSplit         |                | X                              |             |
| SetImageDPI                     |                | X                              |             |
| SetFileConversionTimeoutSeconds |                | X                              |             |
| SetNoPageWidth                  |                | X                              |             |
| SetSimpleLists                  |                | X                              |             |
| SetTitle                        |                | X                              |             |
| SetConnectHyphens               |                | X                              | X           |
| SetEmbedImages                  |                | X                              | X           |
| SetPages                        |                | X                              | X           |
| SetPDFPassword                  |                | X                              | X           |
| SetSearchableImageSetting       |                | X                              | X           |
| SetLanguage                     |                |                                | X           |

## About PDF to HTML

Coding samples are provided here in Python, C#, C++, Java, node.js (JavaScript), PHP, Ruby, Objective-C, Go and VB. Need any more assistance? Please [contact sales](https://apryse.com/form/contact-sales).

Depending on your use case, PDF to HTML can be used for rendering with high fidelity and accuracy or to primarily be used in content extraction. This means our tools can help you to display the output or be used in data analysis workflows.

Here are the different options for PDF to HTML conversion depending on your requirements:

### PDF to HTML for the highest rendering accuracy

Here are the options for maintaining the original PDF layout and visual accuracy.

[WebViewer](/web/what-is-webviewer/overview.md) To convert PDF to HTML canvas in real-time client-side.

[PDF to HTML/ePub](/core/conversion/convert-pdf.md) To convert PDF to fixed layout HTML/ePub where one PDF page becomes one HTML file.

[PDF2SVG](/core/conversion/convert-pdf.md) To convert PDF to SVG to create a vector based image that can be embedded in an HTML file.

[PDF2Image](/core/create/thumbnail.md) To convert PDF to Image (PNG, JPG, TIFF, Raw) to create a raster based image that can be embedded in an HTML file.

### PDF to HTML for extracting semantic content

Here are the options for extracting semantic content from the output.

[PDF2HTML](/cli/pdf2html/pdf2html.md) To convert PDF to a single HTML file that preserves the PDF content using a custom heuristic method.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/conversion/convert-pdf-to-html.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
