This sample shows PDF to HTML conversion in ASP.NET using Bytescout PDF To HTML SDK.

You can select from two options:

Convert PDF to HTML (simple layout)

using System;
using <span data-scayt_word="Bytescout.PDF2HTML" data-scaytid="69">Bytescout.PDF2HTML</span>;

<span data-scayt_word="namespace" data-scaytid="70">namespace</span> <span data-scayt_word="ExtractHTML" data-scaytid="71">ExtractHTML</span>
{
	public partial class _Default : <span data-scayt_word="System.Web.UI.Page" data-scaytid="72">System.Web.UI.Page</span>
	{
		protected void Page_Load(object sender, <span data-scayt_word="EventArgs" data-scaytid="73">EventArgs</span> e)
		{
			// This test file will be copied to the project directory on the pre-build event (see the project properties).
			String <span data-scayt_word="inputFile" data-scaytid="74">inputFile</span> = <span data-scayt_word="Server.MapPath" data-scaytid="75">Server.MapPath</span>("<span data-scayt_word="sample2.pdf" data-scaytid="76">sample2.pdf</span>");

			// Create <span data-scayt_word="Bytescout.PDFExtractor.HTMLExtractor" data-scaytid="77">Bytescout.PDFExtractor.HTMLExtractor</span> instance
			<span data-scayt_word="HTMLExtractor" data-scaytid="78">HTMLExtractor</span> extractor = new <span data-scayt_word="HTMLExtractor" data-scaytid="79">HTMLExtractor</span>();
			<span data-scayt_word="extractor.RegistrationName" data-scaytid="80">extractor.RegistrationName</span> = "demo";
			<span data-scayt_word="extractor.RegistrationKey" data-scaytid="81">extractor.RegistrationKey</span> = "demo";

			// Set plain HTML extraction mode
			<span data-scayt_word="extractor.ExtractionMode" data-scaytid="82">extractor.ExtractionMode</span> = <span data-scayt_word="HTMLExtractionMode.PlainHTML" data-scaytid="83">HTMLExtractionMode.PlainHTML</span>;
			
			// Load sample PDF document
			<span data-scayt_word="extractor.LoadDocumentFromFile" data-scaytid="84">extractor.LoadDocumentFromFile</span>(<span data-scayt_word="inputFile" data-scaytid="85">inputFile</span>);

			<span data-scayt_word="Response.Clear" data-scaytid="86">Response.Clear</span>();
			<span data-scayt_word="Response.ContentType" data-scaytid="87">Response.ContentType</span> = "text/html";

			// Save extracted text to output stream
			<span data-scayt_word="extractor.SaveHtmlToStream" data-scaytid="88">extractor.SaveHtmlToStream</span>(<span data-scayt_word="Response.OutputStream" data-scaytid="89">Response.OutputStream</span>);

			<span data-scayt_word="Response.End" data-scaytid="90">Response.End</span>();

			<span data-scayt_word="extractor.Dispose" data-scaytid="91">extractor.Dispose</span>();
		}
	}
}

Convert PDF to HTML (with layout)

using System;
using <span data-scayt_word="Bytescout.PDF2HTML" data-scaytid="92">Bytescout.PDF2HTML</span>;

<span data-scayt_word="namespace" data-scaytid="93">namespace</span> <span data-scayt_word="ExtractHTML" data-scaytid="94">ExtractHTML</span>
{
	public partial class _Default : <span data-scayt_word="System.Web.UI.Page" data-scaytid="95">System.Web.UI.Page</span>
	{
		protected void Page_Load(object sender, <span data-scayt_word="EventArgs" data-scaytid="96">EventArgs</span> e)
		{
			// This test file will be copied to the project directory on the pre-build event (see the project properties).
			String <span data-scayt_word="inputFile" data-scaytid="97">inputFile</span> = <span data-scayt_word="Server.MapPath" data-scaytid="98">Server.MapPath</span>("<span data-scayt_word="sample2.pdf" data-scaytid="99">sample2.pdf</span>");

			// Create <span data-scayt_word="Bytescout.PDF2HTML.HTMLExtractor" data-scaytid="100">Bytescout.PDF2HTML.HTMLExtractor</span> instance
			<span data-scayt_word="HTMLExtractor" data-scaytid="101">HTMLExtractor</span> extractor = new <span data-scayt_word="HTMLExtractor" data-scaytid="102">HTMLExtractor</span>();
			<span data-scayt_word="extractor.RegistrationName" data-scaytid="103">extractor.RegistrationName</span> = "demo";
			<span data-scayt_word="extractor.RegistrationKey" data-scaytid="104">extractor.RegistrationKey</span> = "demo";

			// Set HTML with CSS extraction mode
			<span data-scayt_word="extractor.ExtractionMode" data-scaytid="105">extractor.ExtractionMode</span> = <span data-scayt_word="HTMLExtractionMode.HTMLWithCSS" data-scaytid="106">HTMLExtractionMode.HTMLWithCSS</span>;
			
			// Load sample PDF document
			<span data-scayt_word="extractor.LoadDocumentFromFile" data-scaytid="107">extractor.LoadDocumentFromFile</span>(<span data-scayt_word="inputFile" data-scaytid="108">inputFile</span>);

			<span data-scayt_word="Response.Clear" data-scaytid="109">Response.Clear</span>();
			<span data-scayt_word="Response.ContentType" data-scaytid="110">Response.ContentType</span> = "text/html";

			// Save extracted text to output stream
			<span data-scayt_word="extractor.SaveHtmlToStream" data-scaytid="111">extractor.SaveHtmlToStream</span>(<span data-scayt_word="Response.OutputStream" data-scaytid="112">Response.OutputStream</span>);

			<span data-scayt_word="Response.End" data-scaytid="113">Response.End</span>();

			<span data-scayt_word="extractor.Dispose" data-scaytid="114">extractor.Dispose</span>();
		}
	}
}