How to Transform a PowerPoint Document in a PDF with Letter Format in Java?

Hi Team,
We are trying to transform PPT to PDF using below code:

Presentation doc =new Presentation("input.pptx");
PdfOptions options = new PdfOptions();
doc.save("pptout.pdf", com.aspose.slides.SaveFormat.Pdf, options);

Can you please specify, how we can change the page size (Letter format).

Attached input file and expected output file.
Files.zip (5.8 MB)

Thanks,
Krishna

@rnara,

Thanks for the sample files.

You may set the slides size in code accordingly, see the sample lines of code for your reference.
e.g.,
Sample code:

Presentation doc =new Presentation("d:\\files\\input.pptx");
doc.getSlideSize().setSize(SlideSizeType.LetterPaper, SlideSizeScaleType.DoNotScale);
com.aspose.slides.PdfOptions options = new com.aspose.slides.PdfOptions();
doc.save("d:\\files\\pptout.pdf", com.aspose.slides.SaveFormat.Pdf, options);

Also, see the documents for your reference.
https://docs.aspose.com/slides/java/slide-size/
https://docs.aspose.com/slides/java/slide-layout/

Hope, this helps a bit.

Hi Team,
I tried the above code shared.
I can see the slides are at corner in output file which is different from what have been shared in expected output pdf file.
Can you explain more how we can use margins to keep the slides in between.
Thanks,
Krishna

@rnara,

Thanks for your feedback.

We need to evaluate your requirements on how to set margins to keep the slides in between while transforming PowerPoint document in a PDF (letter format).

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39494

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@rnara,

I can see the slides are at corner in output file which is different from what have been shared in expected output pdf file.

Could you please tell in which application the expected PDF file was credated? We could not just achieve this result using MS PowerPoint.

Can you explain more how we can use margins to keep the slides in between.

Perhaps the handout will be suitable as an alternative for your needs.

com.aspose.slides.Presentation doc =new com.aspose.slides.Presentation("d:\\files\\input.pptx");
com.aspose.slides.PdfOptions options = new com.aspose.slides.PdfOptions();
com.aspose.slides.HandoutLayoutingOptions slidesLayoutOptions = new com.aspose.slides.HandoutLayoutingOptions();
slidesLayoutOptions.setHandout(com.aspose.slides.HandoutType.Handouts2);
options.setSlidesLayoutOptions(slidesLayoutOptions);
doc.save("d:\\files\\pptout1.pdf", com.aspose.slides.SaveFormat.Pdf, options);

pptout1.pdf (2.1 MB)

API Reference: