How to Start Convert PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

PDF HTML Converter VB.NET Library
How to convert PDF to HTML Webpage in VB.NET Windows Forms application


VB.NET PDF Converter SDK for Converting PDF to HTML Webpage in Visual Basic .NET





In this vb.net spage, you will learn how to convert, export PDF to html webpages in the VB.NET Windows Forms and ASP.NET web application

  • Convert a PDF page or all pages to html files
  • Convert PDF all pages to a single html file
  • Easy to enable PDF to HTML convertion in VB.NET Windows Forms, WPF, Console applications

How to convert PDF to html files using Visual Basic .NET

  1. Download XDoc.PDF html converter vb.net library
  2. Install VB library to convert PDF to html text and image files
  3. Step by Step Tutorial














Why do we need to convert PDF document to HTML webpage using VB.NET programming code? PDF, known as Portable Document Format, has been widely used by enterprises and institutions for document viewing and exchanging. But if you want to publish a PDF document file in web site, there are two factors that you may need to consider. One is that compared with HTML file, PDF file (a document format that can not be easily edited), is less searchable for search engines. The other is the crashing problem when user is visiting the PDF file using web browser.

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 VB.NET code. With this Visual PDF to HTML conversion control component, you are able to perform high fidelity PDF to HTML conversion in VB.NET Web applications and VB.NET Windows projects. Converted HTML files preserve all the contents of source PDF file, like font style and anchors, in VB.NET class application. And below demo code will guide you how to finish the PDF to HTML conversion work.







PDF to HTML Converter Options


You can utilize method "PDFDocument.ConvertToVectorImages()" or "PDFPage.ConvertToVectorImage()" to convert multi-pages PDF file into html web files using VB.NET.
You can define the output html files through method ConvertToVectorImages parameters.


  1. The 1st parameter of the method MUST BE ContextType.HTML.

  2. Valid RelativeType for converting a document to HTML file(s).
    HTML: Output HTML file in the standard format.
    HTMLNF: Output HTML file without embed font.
    MOSS: Output HTML file is compatible with SharePoint application.

  3. All font resource files required by the output HTML files are put in a folder (with folder name "font") in the same directory of those HTML files.

  4. All image resource files required by the output HTML files are put in a folder (with folder name "image") in the same directory of those HTML files.









How to convert PDF file to html webpages in VB.NET code?


The following VB.NET code will show how to easily convert a PDF file to html webpages using VB.NET Code. One pdf page will produce one html webpage file. All web resources (such as web font .woff, images, css) will be generated under other folders.



Dim inputFilePath As String = "C:\1.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' Path of the output folder for all HTML files.
Dim outputFolder As String = "C:\Html"
' Prefix of all output HTML file names. 
Dim fileNamePrefix As String = "File-"
' Convert each page of PDF to a HTML file with file name: [fileNamePrefix][Page Index].html
' Eg.: File-0.html, File - 1.html, ...
doc.ConvertToVectorImages(ContextType.HTML, outputFolder, fileNamePrefix, RelativeType.HTML)






How to convert PDF page to html file in VB.NET code?


Below are the steps and VB.NET demo source code to convert one PDF page to html webpage programmatically using vb.net code.

  1. Define a new PDFDocument object with an existing PDF file loaded
  2. Get a PDFPage object from the second PDF page
  3. Utilize PDFPage.ConvertToVectorImage() method to convert the PDF page to html file with options applied.



Dim inputFilePath As String = "C:\1.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' Path of the output folder for the HTML file.
Dim outputFolder As String = "C:\Html"
' Prefix of the output file name. 
Dim fileNamePrefix As String = "File-"
' Convert the 2nd page to a HTML file with file name: File-1.svg
Dim page As PDFPage = doc.GetPage(1)
page.ConvertToVectorImage(ContextType.HTML, outputFolder, fileNamePrefix, RelativeType.HTML)






How to convert PDF all pages to a single html webpage using VB.NET code?


Sometimes, you want to put a multipage PDF document all pages content into one html webpage. Below are the steps and VB.NET sample code to convert a multipage PDF file to one single html file programmatically in VB.NET application

  1. Define a new PDFDocument object with an existing PDF file loaded
  2. Utilize PDFDocument.ConvertToVectorImage() method to convert PDF and put the all pages content to one html webpage.



Dim inputFilePath As String = "C:\1.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' Path of the output folder for the HTML file.
Dim outputFolder As String = "C:\Html"
' Output file name.
Dim fileName As String = "output"
' Convert the whole PDF document to a HTML file: output.html
doc.ConvertToHtml(outputFolder, fileName, RelativeType.HTML)