PPTX to PDF: Exported PDF with default options becomes 4 times larger than presentation (C# .NET)

Hi,

I’m investigating file size changes when exporting a PPTX file to PDF.

My code is simply this:
var pres = new Presentation(fileName);
pres.Save(root + “\Pres.pdf”, SaveFormat.Pdf);

I’ve done some tests using different presentations using different presentations to see how the produced PDF file changed.

Using the attached presentation I have something like this:

  • Aspose.Slides 17.4: 1.9 MB
  • Aspose.Slides 19.1: 17.5 MB
  • Aspose.Slides 19.5: 9.5 MB

(Produced files are attached)

Using a presentation from one of our customer (unfortunately I cannot share it), using the same code, I have this results:

  • Aspose.Slides 17.4: 2 MB
  • Aspose.Slides 19.1: 15.2 MB
  • Aspose.Slides 19.5: 15.3 MB

In other tests Aspose.Slides 19.5 gave even more large files compared with 19.1.

How can we explain these differences? In particular from 17.4 to recent versions.

Thanks
Pres.zip (7.7 MB)

Pres-sample-17.4.pdf (1.9 MB)
Pres-sample-19.5.pdf (9.3 MB)

@andreagasparin,

I have worked with the sample file shared by you. An issue with ID SLIDESNET-41218 has been created in our issue tracking system to further investigate and resolve the issue. We will share good news with you soon.

Hi @Adnan.Ahmad,

We would like to raise the priority of this issue, is it possibile? Or do I need to create a new one under the paid support forum?

thanks

@andreagasparin,

Thanks for contacting us. I like to inform that we have number of options to adjust desired images quality in generated PDF. Using them the PDF size can be decreased. Please check following sample code.

using (Presentation pres = new Presentation(“pres.pptx”))
{
pres.Save(“pres.pdf”, SaveFormat.Pdf, new PdfOptions
{
BestImagesCompressionRatio = true,
SufficientResolution = 64,
JpegQuality = 95
});
}

Please let us know if this solution satisfy you.

We already use those properties but here we are not touching them because we want the output presentation to be in high quality, so this is not an option for us.

Did you managed to convert the issue to a priority issue?

Thanks and best regards

@andreagasparin,

If you have paid support subscription then you can log a ticket in Paid Support help desk separately.

Ok, I’ve opened a new ticket in the paid support forum, thanks

@andreagasparin,

Thank you for sharing the feedback.

@andreagasparin,

I like to inform that we have investigated this issue in details and i like to share our findings with you. Files can be downloaded from this link.

  • Sample presentation contains several big images. File size increasing is a result of output images quality improvement added to Aspose.Slides 18.6 release. If you compare images on the first page of Pres.18.5-out.pdf and Pres.19.9-out.pdf it is easy to notice, that Slides 18.5 release output has blurry image opposite to sharp and high-quality one in 19.9 output even with 300% and more zoom in pdf.

  • To find a compromise between quality and file size, you could use PdfOptions.JpegQuality parameter as we suggested you earlier. Please compare Pres.19.9-out.pdf and Pres.19.9-out-JpegQuality50.pdf output files.

  • If you don’t want to use PdfOptions.JpegQuality parameter, it is possible for us to to control images resolution comparing to original presentation images. Check Pres.19.11-out-Resolution75.pdf output result.

  • Anyway the general principle with pdf containing images - the better image quality the bigger file size. We can’t significantly reduce output pdf file size for the sample presentation without affecting images quality.

  • Just to compare check Pres-PowerPoint2013-out.pdf file that shows how PowerPoint 2013 converts sample presentation to pdf. File size is small, but images are blurry.

Hi Adnan Ahmad,
I have investigate more deeply regarding this problem and I found that my issue is due to the setting of the “pdfOptions.SufficientResolution” property.
When we put in document a image with high dpi (384 in my case) and the SufficientResolution equal to 220 the pdf file is very large compared to the files created with SufficientResolution equal to 96 or 400.
I don’t have this issue if I use the version 17.4 of Aspose.Slides.
I attached a simple program to replicate the issue.OP-8612.zip (2.7 MB)

@andreagasparin,

Thank you for sharing the feedback. I have associated information in our issue tracking system and will share feedback with you once it will be fixed.

Hi Mudassir,

We’ve noticed that the PDF file size is still quite large under Slides version 20.2. Based on this thread, it sounds like @andreagasparin opened a Paid Support Ticket. However it is unclear if there were any code changes on Aspose’ side to address the increased PDF file size.

We are trying to upgrade our Slides version, but a major drawback is that the latest Slides version generates PDFs that are more than double the size of the version we are currently using. When we examine the PDFs visually, we don’t see many deltas in terms of content (text, formatting, images, charts, etc). Since the PDFs are sent over the wire, we’re concerned about the impact on performance, memory and bandwidth incurred by the increased file size.

Would you be able to provide any details if Aspose is still working on fixing this issue or if it is considered closed now?

Thank you.

@oraspose,

I have verified from our issue tracking system and like to share that there are some implementations that have been carried in Aspose.Slides for .NET 20.2 and some further enhancements shall follow in upcoming 20.3 as well. PDF export optimization can be improved by together with using following two properties.

PdfOptions.BestImagesCompressionRatio flag : It doesn’t affect visible image quality, so all high quality images will be still the same as the customer wish) that will help to reduce output PDF file size up to 50% comparing to older versions.
SufficientResolution property to reduce the size as well. By default its 96 for Aspose APIs

The following code should be used to reach maximum effect:

using (Presentation pres = new Presentation("pres.pptx"))
{
    PdfOptions options = new PdfOptions();
    options.BestImagesCompressionRatio = true;
    options.SufficientResolution = 64;
    options.JpegQuality = 95;
    pres.Save("pres.pdf", SaveFormat.Pdf, options);
}