Html Plugin

Overview

The Aspose.Pdf.LowCode.Html plugin handles HTML conversion workflows. Use PdfToHtmlOptions to convert PDF to HTML and HtmlToPdfOptions to convert HTML input to PDF output.

Convert PDF to HTML

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ConvertPdfToHtmlWithPlugin()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion_PDFToHTMLFormat();

    // Create PDF Html plugin
    var plugin = new Aspose.Pdf.LowCode.Html();

    // Configure HTML conversion options
    var options = new Aspose.Pdf.LowCode.PdfToHtmlOptions(
        Aspose.Pdf.LowCode.PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
    options.AddInput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "PDFToHTML.pdf"));
    options.AddOutput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "ConvertPdfToHtml_out.html"));

    // Convert the file
    var result = plugin.Process(options);

    // Get the path of the saved HTML document
    var outputPath = result.ResultCollection[0].ToFile();
}

Options

PdfToHtmlOptions.SaveDataType controls whether HTML resources are embedded or written externally. Use HtmlToPdfOptions when the input data source is HTML and the output target is PDF.