Png Plugin

Overview

The Aspose.Pdf.LowCode.Png plugin renders PDF pages as PNG images. Configure the operation with PngOptions, add input and output data sources, and call Process.

Convert PDF to PNG

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

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

    // Configure PNG conversion options
    var options = new Aspose.Pdf.LowCode.PngOptions();
    options.OutputResolution = 300;
    options.PageList = new System.Collections.Generic.List<int> { 1 };
    options.AddInput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "ConvertAllPagesToBmp.pdf"));
    options.AddOutput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "PdfToPng_out\\"));

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

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

Options

Use OutputResolution to set image resolution and PageList to choose pages.