Pptx to pdf to jpg

Hi,

Is it possible to read a single page pptx into a presentation, convert it to a pdf in memory, and then convert the pdf into jpg format (still in memory) and then display it on an aspx page?

Thanks

Dear Brad,

Yes, this is possible to convert a given PPTX to PDF or Jpg using streams. Aspose.Slide actually when converts to PDF uses the Jpg image of slide at back end. However, if it is desired to convert PPTX to PDF and then PDF to Jpg then you may have to use Aspose.Slides for converting PPTX to PDF and then Aspose.PDF for .NET to convert PDF to Jpg and subsequently depicting that Jpg on aspx page. My suggestion is to convert PPTX slide to Jpg thumbnail using stream and then depict that on aspx page.

Thanks and Regards,

Hi Mudassir,

I am currently using the thumbnail method. It does not create a clear image. I was looking for a way to get a clearer image. (See 257621).

Will try to go through the pdf and see the results.

Brad

Hi Mudassir,

I have created a simple site which attempts to create a jpg from a pdf from a pptx:

I only got part way when the process blew up inside the presentationEx.Save to pdf function. Can't figure what is wrong there.

Also, could not see how to create a jpg from the pdf once it is created.

Any ideas would be appreciated.

Dear Brad,

I have observed the code snippet shared by you and have worked over it using Aspose.Slides for .NET 4.3.0. I have not encountered any issue while generating the PDF using the shared code snippet. For your kind reference, I have shared the generated PDF as well. Please share with us, if you may have any further inquiry.

Thanks and Regards,

Hi Mudassir,

I thought I saw the answer in your reply. I was using Slides 4.2; figured the 4.3 would fix the problem. It did not. I still get the error. Attached is the error that I get.

Also, once we figure out this problem, how does one create a jpg from the pdf? I thought there would be a function (like pres.Save in Slides) in Aspose.Pdf, but I have not found one.

Thanks

Hello Brad,

I have worked with the project code shared by you and have modified that to convert to PPTX to PDF and PDF to image. I have used Aspose.Slides for .NET 4.3.0 and Aspose.Pdf.Kit for .NET 4.9.0. For your kind reference, I have attached the generated image as well.

Thanks and Regards,

Hi Mudassir,

I see that you have succeeded, thanks (and the jpg looks much clearer than using thumbnails).

I still get the error that I sent before, even with your code and all your Aspose bin files!? I even tried removing our license file; still get the error.

What might there be that would cause this error? It is apparently something outside of the site itself, since all our code is now the same.

I get warnings from your refresh files. I also notice that you are using 2.0 files. I originally had been using 3.5; both give me the same error that I had before.

Brad

Dear Brad,

Can you please verify that standard fonts like "Arial" and "Times New Roman" are installed on the machine. Its likely that exception is raised because of this issue. Please share your findings with us. For your kind reference, I have also attached the generated slide thumbnail and you can compare the quality of thumbnail with the one generated from PPTX->PDF to Image.

Thanks and Regards,

Hi Mudassir,

It looked to me like all the text in the pptx was Helvetica. I changed them to Arial and still got the error. Arial and Times New Roman are both installed on my development machine.

The png that you sent does look as good as the jpg. It is also considerably better than what I am getting with thumbnails. How did you create it? I assume that a jpg generated with your method would also look that good; if it does, then I don't have to go the long way around (but I still need to know how to do it).

Thanks

Dear Brad,

I have used the following code snippet to generate the slide thumbnail and you can compare that the generated thumbnail will have the quality comparable to as that of from method you are generating. Please share, if you may have any further queries.

Dim oPres as PresentationEx = New PresentationEx(sPath)

Dim sld As SlideEx = oPres.Slides(0)

'Create a full scale image

Dim bmp As Bitmap = sld.GetThumbnail(2.0F, 2.0F)

'Save the image to disk in JPEG format

bmp.Save("d:\ContentBG_tnail.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)

Thanks and Regards,

Dear Brad,

Can you please try the shared version of Aspose.Slides for .NET. Hopefully, it may resolve the exception you are experiencing.

Thanks and Regards,