PPTX to PDF conversion reduces quality of images

Hello,

We currently have a license for Aspose version 19.9 (Java), and are facing the following issue with Aspose Slides:

When saving a Powerpoint presentation(.pptx) to pdf, any SVG images in the presentation are saved with reduced quality.

The images in the presentation are vector images, but when saved to pdf they are NOT vector anymore, but rather rasterized.

We do not see this vector to raster image conversion when saving a Word document(.docx) to pdf.

I have attached a zip file with the various results.

Aspose_test_results.zip (109.7 KB)

@kurtosys,

I have observed the issue shared by you and request you to please first try using latest Aspose.Slides for Java 20.3 on your end. In case there is still an issue then please share the source information, used sample code. generated output and desired output with us.

Hi Mudassir,

Thank you for the swift response.

I have repeated the test with Aspose slides version 20.3 and received the same result.

Please see the attached zip file with the following:

  • readme.txt
  • input.pptx
  • expected_output.pdf
  • actual_output.pdf
  • sample code

Let me know if you need anything else from our side.
Aspose_test_20.3.zip (201.4 KB)

@kurtosys,

I have observed the issue shared by you and have tried opening the expected and generated output PDF on my end. I have not been able to observe any issue in both PDF. For your kind reference, I have attached the snapshot displaying both PDF views.

Hi Mudassir,

If you zoom in on the actual output, you will see the edges of the text begins to pixelate, if you zoom in on the expected output, you will not see the same pixelation. This is because actual is a raster image, and expected is a vector image.

@kurtosys,

I suggest you to please visit this documentation link and consider setting options for JPEG quality to higher values.

PdfOptions opts=new PdfOptions();
opts.setSufficientResolution(2);

@mudassir.fayyaz

I have tried the above method and there has been no improvement in image quality. Aspose slides is still saving a raster image, instead of a vector image.

@kurtosys,

Thank you for sharing the details with us. I have been able to reproduce the quality related issue but the PDF generated using Aspose.Slides and PowerPoint 2016 are identical. Can you please share how you have created the desired PDF. Which version of PowerPoint you have used and settings for these.

@mudassir.fayyaz

The drop in quality is due to the “type” of image, raster vs vector. The PDF looks the same, but the Aspose slides version has a lower quality image (a raster image), instead of a higher quality image (a vector image).

@kurtosys,

I have worked with the presentation file shared and have observed the issue. An issue with ID SLIDESJAVA-38081 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hi Mudassir,

Just checking in to see if there has been any progress on this issue.

@kurtosys,

I have verified from our issue tracking system and like to share that the concerned issue has been marked as resolved in Aspose.Slides for Java 20.4.

We like to share that this is expected behavior because the you have used PNG image in this presentation. You should use vector image and options.setSaveMetafilesAsPng(false) to achieve the desired result.
We have created the following code snippets to demonstrate it (Please See 38081_cmp.png ).

For SVG image:

Presentation presSvg = new Presentation(); ISvgImage svgImage = new SvgImage(new String(Files.readAllBytes(Paths.get("image2.svg")), StandardCharsets.UTF_8)); IPPImage imageSvg = presSvg.getImages().addImage(svgImage); presSvg.getSlides().get_Item(0).getShapes().addPictureFrame( ShapeType.Rectangle, 0, 0, 500, 500, imageSvg); PdfOptions optsSvg = new PdfOptions(); optsSvg.setSaveMetafilesAsPng(false); presSvg.save("Saved_svg.pdf", SaveFormat.Pdf, optsSvg);

For PNG image:

Presentation presPng = new Presentation(); IPPImage imagePng = presPng.getImages().addImage(Files.readAllBytes(Paths.get("image1.png"))); presPng.getSlides().get_Item(0).getShapes().addPictureFrame( ShapeType.Rectangle, 0, 0, 500, 500, imagePng); PdfOptions optsPng = new PdfOptions(); optsPng.setBestImagesCompressionRatio(true); presPng.save("Saved_png.pdf", SaveFormat.Pdf, optsPng);

Unfortunately the recommended fix did not resolve the issue. The vector graphics are still being converted to rasters. I have attached the logged output which shows the aspose slides version used, as well as the required option (setSaveMetafilesAsPng) being set to false. I have also attached the input, output (genrated by aspose slides) and output_expected (exported from powerpoint).

aspose support.zip (180.3 KB)

@kurtosys,

I have associated information in our issue tracking system and will be able to share feedback with you as soon as it will be shared with me. I request for your patience in this regard.

1 Like

Hello. Can I get feedback on the state of this query please? I will. be checking in every few days if I do not get additional info on the status of the issue.

@kurtosys,

Actually, you have used PNG image but trying to get vector graphic. You should replace PNG image with SVG image to get desired results.

You are incorrect. I have used SVGs. I have provided the SVG source files that I have used. I have also provided a second test case that I ran alongside with a different svg.

aspose support 2.zip (1.1 MB)

@kurtosys,
We have worked again on our end and have shared our examples and output. Please use scale 400% or 800%. And compare your current image and replaced image.

TestExample.zip (747.0 KB)

From the provided sample code and output it seems that the svg images that are embedded and not replaced are rendered as rasters and not vectors. Is this correct? If that is the case the fix you have suggested does not solve the problem.

@kurtosys,

I’m sorry for your inconvenience. Can you please explain the observation that you have shared.