Free Support Forum - aspose.com

PPTX to PDF - Reflection and scaling errors

When converting from PPTX to PDF with notes, there are two issues.
Firstly, we are seeing warnings reported by Aspose (see screenshot below), however it does translate the file.
Secondly, the slides are not resized to fit the notes page area. However, if the paper size is not set to be A4, the slides are resized.

Here’s the code:
public static void convertPPTX2PDF(String inputPath, String outputPath) throws Exception {
try {
com.aspose.slides.Presentation presentation = new com.aspose.slides.Presentation(inputPath);

        com.aspose.slides.PdfOptions options = new com.aspose.slides.PdfOptions();

        INotesCommentsLayoutingOptions commentLayout = options.getNotesCommentsLayouting();
        commentLayout.setNotesPosition(NotesPositions.BottomFull);
        
        presentation.getSlideSize().setSize(SlideSizeType.A4Paper, SlideSizeScaleType.DoNotScale);

        presentation.save(outputPath, com.aspose.slides.SaveFormat.Pdf, options);
        System.out.println("Translated " + inputPath + " to " + outputPath);
    }
    catch(Exception e) {
        System.out.println("Unable to translate");
    }
}

Warnings reported by Aspose when converting a pptx to pdf:
image.png (8.2 KB)

The presentation slide has not been resized to fit the notes page when setting it to be A4 (the screenshot on the left is the PDF created by Aspose and the PDF on the right is created by doing a print to PDF in PowerPoint):
image.png (26.7 KB)

Sample Files:
PPTX2PDF Sample Files.zip (217.3 KB)

@simon.wiseman

The problem lies in following statement where you have changed the slide size and have choose the option Do not scale. By doing so, you are telling API to change the slide size and shapes will not be scaled with respect to new slide size and they should remain as original. You need to scale the shapes here as well.

For your other issue concerning to warnings, please share the Java and Operating System details on your end.

Operating System - Microsoft Windows Version 1909 (OS Build 18363.1256).
Java Version - Java™ SE Development Kit 11.0.4 (64-bit).

Java Version:
java version “11.0.4” 2019-07-16 LTS
Java™ SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)

We have changed the code from:
presentation.getSlideSize().setSize(SlideSizeType.A4Paper, SlideSizeScaleType.DoNotScale);
To:
presentation.getSlideSize().setSize(SlideSizeType.A4Paper, SlideSizeScaleType.EnsureFit);
and it now works - thank you for your help.

@simon.wiseman

It’s good to know that suggested option has worked on your end.

For issue regarding warnings appearing when rendering slides, a ticket with ID SLIDESJAVA-38373 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 addressed.

Amazing, thank you.

@simon.wiseman

You are always welcome.