HTML-Konverter für .NET
Einführung in HTML Converter für .NET
Der HTML Converter für .NET ist ein leistungsstarkes Plugin, das Entwicklern ermöglicht, PDF-Dokumente in HTML-Seiten zu konvertieren.Dieser Leitfaden bietet einen Überblick über die verfügbaren Funktionen und erklärt, wie man gemeinsame Aufgaben mit Code Beispielen in .Net durchführen kann.
Installation des HTML Converters
Um mit dem HTML Converter für .NET zu beginnen, müssen Sie das Aspose.Pdf NuGet-Paket installieren.
Install-Package Aspose.PDF
Alternativ können Sie die DLL herunterladen und sie als Referenz zu Ihrem Projekt hinzufügen.
Konvertierung von PDF in 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);