For the complete documentation index, see llms.txt. This page is also available as Markdown.

Convert PDF to HTML on Server/Desktop

There are two HTML conversion modules.

Fixed position The built-in HTML module is used to convert PDF documents to fixed-position HTML documents.

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.

// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.ToHtml(filename, output_filename);
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert::ToHtml(filename, output_filename);
// Convert PDF document to HTML with fixed positioning option turned on (default)
ConvertToHtml(filename, output_filename)
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.toHtml(filename, output_filename);
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);
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.toHtml(filename, output_filename)
// Convert PDF document to HTML with fixed positioning option turned on (default)
[PTConvert ToHtmlWithFilename:filename out_filename:output_filename options:nil];
// Convert PDF document to HTML with fixed positioning option turned on (default)
Convert::ToHtml($filename, $output_filename);
# Convert PDF document to HTML with fixed positioning option turned on (default)
Convert.ToHtml(filename, output_filename)

PDF Converter (SVG, XPS, TIFF, JPG, RTF, TXT, More) 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.

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);
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);
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)
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);

Convert with reflow paragraphs (deprecated)

To convert PDF Documents to HTML format with reflow paragraphs.

Convert PDF to HTML - Sample Code 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.

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 To convert PDF to HTML canvas in real-time client-side.

PDF to HTML/ePub To convert PDF to fixed layout HTML/ePub where one PDF page becomes one HTML file.

PDF2SVG To convert PDF to SVG to create a vector based image that can be embedded in an HTML file.

PDF2Image 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 To convert PDF to a single HTML file that preserves the PDF content using a custom heuristic method.

Last updated

Was this helpful?