Tech Specs
How-to C#
How-to VB.NET
C# PDF: How to HTML5 Viewer & Editor PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Convert PDF to HTML
Home ›› XDoc.PDF ›› C# PDF: Convert PDF to HTML

How to convert, turn Adobe PDF file to html webpage files using C# XDoc.PDF for .NET library

Create html web files (html, css, javascript files) from PDF document in C# .NET Program. Online Free Download.

Best C#.NET PDF Converter SDK for converting PDF to HTML in Visual Studio .NET

Free .NET framework library for converting PDF to HTML in both C#.NET WinForms and ASP.NET application

Complete sample source code for quick integration and converting pdf to htm in C#.NET class

Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint

Embed converted HTML files in HTML page or iframe

Use Javascript (jquery) to control PDF page navigation

Cross browser supported, like chrome, firefox, ie, edge, safari

Embed zoom setting (fit page, fit width)

Turn PDF form data to HTML form

Export PDF images to HTML images

Auto conversion hyperlinks (url links) inside PDF document to html format

Full featured online tools for pdf to html conversion without email required, and no watermark embeded

Our PDF to HTML converter library control is a 100% clean .NET document image solution, which is designed to help .NET developers convert PDF to HTML webpage using simple C# code. This Visual C#.NET PDF to HTML conversion control component makes it extremely easy for C# developers to convert and transform a multi-page PDF document and save each PDF page as a separate HTML file in .NET class application.

The HTML document file, converted by C#.NET PDF to HTML converter toolkit SDK, preserves all the original anchors, links, bookmarks and font style that are included in target PDF document file. Besides, the converted HTML webpage will have original formatting and interrelation of text and graphical elements of the PDF.

This C#.NET PDF to HTML conversion library can eliminate the crashing issue of web browser when it is trying to display a PDF document file inside a browser window. Besides, this PDF converting library also makes PDF document visible and searchable on the Internet by converting PDF document file into HTML webpage.

How to Use C#.NET Demo Code to Convert PDF Document to HTML5 Files in C#.NET Class

Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


       If using x86, the platform target should be x86.

This is a C# programming example for converting PDF to HTML.

        #region pdf to html (one page)
        internal static void convertPdfPageToHtml()
            String inputFilePath = @"";
            String outputDirectory = @"";
            PDFDocument doc = new PDFDocument(inputFilePath);
            int pageIdx = 0; //first page
            BasePage page = doc.GetPage(pageIdx);
            page.ConvertToVectorImage(ContextType.HTML, outputDirectory, "0", RelativeType.HTML);

        #region pdf to html (all page)
        internal static void convertPdfToHtml()
            String inputFilePath = @"";
            String outputDirectory = @"";
            PDFDocument doc = new PDFDocument(inputFilePath);
            doc.ConvertToVectorImages(ContextType.HTML, outputDirectory, "fileName", RelativeType.HTML);

C# converting two or multiple PDF files to html (batch conversion)

        #region pdf to html (batch files and single tread)
        internal static void pdfFilesToHtml()
            String inputDirectory = @"C:\input\";
            String outputDirectory = @"C:\output\";
            String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
            foreach (String filePath in files)
                int startIdx = filePath.IndexOf("\\");
                int endIdx = filePath.IndexOf(".");
                String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
                PDFDocument doc = new PDFDocument(filePath);
                doc.ConvertToVectorImages(ContextType.HTML, outputDirectory, docName, RelativeType.HTML);

.NET Class Namespace Required

Add necessary references:










Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

public override void ConvertToVectorImages(ContextType targetType, String directory, String fileName, RelativeType type)

     Convert to html/svg files and save it on the disk.