ХТМЛ конвертер за .NET

Увод у ХТМЛ конвертер за .NET

ХТМЛ конвертер за .НЕТ је моћан плугин који омогућава програмерима да претварају ПДФ документе у HTML странице. Овај водич пружа преглед доступних функција и објашњава како извршити уобичајене задатке користећи примере кода у .NET-у.

Инсталирање ХТМЛ конвертера

Да бисте започели са ХТМЛ конвертером за .НЕТ, потребно је да инсталирате Асписе.Пдф Пакет НуГет.

Install-Package Aspose.PDF

Alternativno, možete preuzeti DLL i dodati ga kao referencu vašem projektu.

Претварање ПДФ-а у ХТМЛ

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);
 Српски