HTML Converter for .NET

Introduction to HTML Converter for .NET

The HTML Converter for .NET is a powerful plugin that enables developers to convert PDF documents into HTML pages. This guide provides an overview of the available features and explains how to perform common tasks using code examples in .NET.

Installing the HTML Converter

To get started with the HTML Converter for .NET, you need to install the Aspose.Pdf NuGet package. You can do this by running the following command in the NuGet Package Manager Console:

Install-Package Aspose.PDF

Alternatively, you can download the DLL and add it as a reference to your project.

Converting PDF to HTML

Converting PDF documents HTML is one of the primary features of the HTML Converter. You can achieve this by using the PdfHtml class to load the PDF document and then saving it as an HTML file.

// Specify the input and output paths for the PDF document.
var inputPath = Path.Combine(@"C:\Samples\", "sample.pdf");
var outputPath = Path.Combine(@"C:\Samples\", "sample.html");

// Create a new instance of the PdfHtml class.
var plugin = new PdfHtml();

// Create a new instance of the PdfToHtmlOptions class.
var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);

// Add the input and output paths to the PdfToHtmlOptions.
options.AddInput(new FileDataSource(inputPath));
options.AddOutput(new FileDataSource(outputPath));

// Process the PDF to HTML conversion and get the result container.
var resultContainer = plugin.Process(options);

// Get the result from the result container.
var result = resultContainer.ResultCollection[0];

// Print the result to the console.
Console.WriteLine(result);
 English