EvoPdf Classic · PDF to HTML

EVO PDF to HTML for .NET

EVO PDF to HTML Converter for .NET can be used in any type of .NET application to convert PDF pages to HTML documents. It can be integrated into any .NET application, both ASP.NET web sites and desktop applications, to add PDF to HTML conversion capabilities to your application. You can set the resulted HTML content zoom level and the HTML images resolution.

Classic v14.0 · Windows, .NET Framework 4.0+ and .NET 6–10 · Evaluate without registration — demo mode by default (watermarked) · Licensed with the EVO PDF Toolkit

$dotnet add package EvoPdf.PdfToHtml

Windows · .NET Framework 4.0+ and .NET 6–10 (.NET Standard 2.0)

Program.csC#
using EvoPdf.PdfToHtml;

var converter = new PdfToHtmlConverter();
converter.ConvertPdfPagesToHtmlFile(
    "document.pdf", 1, 0, "out", "page");
Classic API: EvoPdf.PdfToHtml namespace, one converter class, synchronous calls. API reference →
  • Windows 10 / 11 / Server 2016–2025
  • .NET Framework 4.0 – 4.8.1
  • .NET 6 → 10, .NET Standard 2.0
  • Azure Cloud Services & Virtual Machines
  • Web, console and desktop applications
Features

What the PDF to HTML component does

  • Convert PDF pages to HTML documents
  • Customize the generated HTML content zoom level
  • Customize the HTML images resolution in generated HTML document
  • Convert PDF pages to HTML documents in memory or to HTML files in a folder
  • Support for password protected PDF documents
  • Convert to HTML only a range of PDF pages
  • Get the number of pages in a PDF document
  • Get the PDF document title, keywords, author and description
  • Does not require Adobe Reader or other third party tools
  • Support for .NET 4.0 framework and later
  • Documentation and C# samples for all the features
In detail

EVO PDF to HTML for .NET — how it works

EVO PDF to HTML Converter fo .NET

EVO PDF to HTML Converter for .NET can be used in any type of .NET application to convert PDF pages to HTML documents. The integration with existing .NET applications is extremely easy and no installation is necessary. The downloaded archive contains the assembly for .NET and a demo application.

The full C# source code for the demo application is available in the Samples folder. The converter produces HTML string objects during conversion that you can save to HTML files or use for further processing. You can also customize the resulted HTML content zoom level and HTML images resolution.

The code below was taken from the PDF to HTML Converter demo application available for download in the PDF to HTML converter archive. In this sample an instance of the PdfToHtmlConverter class is constructed and used to convert the PDF document pages to HTML documents.

At a glance

Component
EvoPdf Classic · PDF to HTML
NuGet package
EvoPdf.PdfToHtml
Namespace
EvoPdf.PdfToHtml
Main class
PdfToHtmlConverter
Runs on
Windows · .NET Framework 4.0+ · .NET 6–10 (.NET Standard 2.0)
Version
Classic v14.0
License
EVO PDF Toolkit; evaluation without registration
Documentation →
Sample.csC#
private void btnConvertToHtml_Click(object sender, EventArgs e)
{
    if (pdfFileTextBox.Text.Trim().Equals(String.Empty))
    {
        MessageBox.Show("Please choose a source PDF file", "Choose PDF file", MessageBoxButtons.OK);
        return;
    }

    // the source pdf file
    string pdfFileName = pdfFileTextBox.Text.Trim();

    // start page number
    int startPageNumber = int.Parse(textBoxStartPage.Text.Trim());
    // end page number
    // when it is 0 the conversion will continue up to the end of document
    int endPageNumber = 0;
    if (textBoxEndPage.Text.Trim() != String.Empty)
        endPageNumber = int.Parse(textBoxEndPage.Text.Trim());

    // create the converter object and set the user options
    PdfToHtmlConverter pdfToHtmlConverter = new PdfToHtmlConverter();

    // set the resolution of HTML images
    pdfToHtmlConverter.Resolution = int.Parse(textBoxResolution.Text);

    // set the zoom of HTML content
    pdfToHtmlConverter.Zoom = int.Parse(textBoxZoom.Text);

    // the demo output directory
    string outputDirectory = Path.Combine(Application.StartupPath, @"DemoFiles\Output");

    Cursor = Cursors.WaitCursor;
            
    try
    {
        // convert PDF pages to HTML files in a directory
        pdfToHtmlConverter.CreateIndexFile = true;
        pdfToHtmlConverter.ConvertPdfPagesToHtmlFile(pdfFileName, startPageNumber, endPageNumber, outputDirectory, "PdfPage");

        // uncomment the lines below to raise the PageConvertedEvent event when a PDF page is converted
        // the pdfToHtmlConverter_PageConvertedEvent handler below will be executed for each converted PDF page
        // Do not forget to uninstall the handler when is not needed anymore
        //pdfToHtmlConverter.PageConvertedEvent += pdfToHtmlConverter_PageConvertedEvent;
        //pdfToHtmlConverter.ConvertPdfPagesToHtmlInEvent(pdfFileName, startPageNumber, endPageNumber);

        // uncomment the line below to convert PDF pages in memory to an array of PdfPageHtml objects
        //PdfPageHtml[] pdfPageHtmls = pdfToHtmlConverter.ConvertPdfPagesToHtml(pdfFileName, startPageNumber, endPageNumber);
    }
    catch (Exception ex)
    {
        // The conversion failed
        MessageBox.Show(String.Format("An error occurred. {0}", ex.Message), "Error");
        return;
    }
    finally
    {
        Cursor = Cursors.Arrow;
    }

    try
    {
        System.Diagnostics.Process.Start(outputDirectory);
    }
    catch (Exception ex)
    {
        MessageBox.Show(string.Format("Cannot open output folder. {0}", ex.Message));
        return;
    }
}

/// <summary>
/// The PageConvertedEvent event handler called after when a PDF page was converted to HTML
/// The event is raised when the ConvertPdfPagesToHtmlInEvent() method is used
/// </summary>
/// <param name="args">The handler argument containing the PDF page HTML and page number</param>
void pdfToHtmlConverter_PageConvertedEvent(PageConvertedEventArgs args)
{
    // get the HTML document and page number from even handler argument
    string  pdfPageHtml = args.PdfPageHtml.Html;
    int pageNumber = args.PdfPageHtml.PageNumber;

    // save the PDF page HTML to a file
    string outputHtmlFile = Path.Combine(Application.StartupPath, @"DemoFiles\Output", "PdfPage_" + pageNumber + ".html");
    File.WriteAllText(outputHtmlFile, pdfPageHtml, Encoding.UTF8);

    args.PdfPageHtml.Dispose();
}
Licensing

Perpetual licenses, updates and support included for a year

The HTML to PDF Converter license (450 USD Deployment / 1200 USD Company) covers the Classic and the Next converter; the EVO PDF Toolkit (650 / 1400 USD) covers every component on this site, Classic tools included. The Company License includes redistribution.