How to Convert All Pages of a PDF to PPT where each pdf page comes as images

Convert All Pages of a PDF to PPT where each pdf page comes as images instead of selectable text in the PPT

Hi there,

Thanks for your inquriy. I am afraid currently Aspose.Pdf does not render text data as image in PDF to PPTX conversion. We have logged an enhancement ticket PDFNET-42286 in our issue tracking system for the requirement. We will keep you updated about the issue resolution progress within this forum thread.

Furthermore as a workaround, you can convert PDF pages to images, create a new PDF from the images and finally convert that PDF document to PPTX. Please check following sample code snippet. Hopefully it will help you to accomplish the task.

// Open the PDF document
Aspose.Pdf.Document doc = new Aspose.Pdf.Document("test.pdf");

// Create a new PDF document to store images
Aspose.Pdf.Document doc1 = new Aspose.Pdf.Document();

for (int pageCount = 1; pageCount <= doc.Pages.Count; pageCount++)
{
    // Create a new page for the output document
    Page page = doc1.Pages.Add();

    // Create a MemoryStream to store the image
    MemoryStream imageStream = new MemoryStream();

    // Create a PNG device with the specified resolution
    Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
    PngDevice pngDevice = new PngDevice(resolution);

    // Convert the PDF page to PNG and save the image to the MemoryStream
    pngDevice.Process(doc.Pages[pageCount], imageStream);

    // Create an Image object and set the image type
    Aspose.Pdf.Image image = new Aspose.Pdf.Image();
    image.ImageStream = imageStream;
    image.ImageType = ImageType.Png; // Set the image type to PNG

    // Add the image to the page
    page.Paragraphs.Add(image);
}

// Create a MemoryStream to save the output document
MemoryStream ms = new MemoryStream();

// Save the output PDF document to the MemoryStream
doc1.Save(ms);

// Load the output document to convert it to PPTX
doc1 = new Aspose.Pdf.Document(ms);

// Instantiate PptxSaveOptions instance
Aspose.Pdf.PptxSaveOptions pptx_save = new Aspose.Pdf.PptxSaveOptions();

// Save the output in PPTX format
doc1.Save("PDFToPPT_out.pptx", pptx_save);

Please feel free to contact us for any further assistance.

Best Regards,

@smssms666,

Thanks for your patience.

We are pleased to share that the feature to render text of PDF file as Image in resultant PPT file has been implemented in recent release of Aspose.Pdf for .NET 17.9. Please try using the latest release with following code snippet.

[C#]

Aspose.Pdf.Document doc = new Aspose.Pdf.Document("HelloWorld.pdf));
// Instantiate PptxSaveOptions instance
Aspose.Pdf.PptxSaveOptions pptx_save = new Aspose.Pdf.PptxSaveOptions();
// Save the output in PPTX format
pptx_save.SlidesAsImages = true;
doc.Save("PDFToPPT_out_.pptx", pptx_save);
1 Like