Inconsistent Page Orientation when Converting Presentation to PDF in C# and Java

Good day,

We are currently using Aspose.Slides to convert supported presentation files to PDFs. When exporting with speaker notes, we’ve noticed the page orientation in the PDFs is inconsistent. And the API does not have the ability to override this from what I can tell, so we can’t force a specific page orientation.

Digging into the issue with a couple different PPTX files, I’ve discovered that it comes down to the slide layout type. If Aspose reports the slide layout type as “Custom”, those pages slides will be in Landscape orientation when exporting to PDF with speaker notes. If Aspose detects the slide as any other type, it’ll be in Portrait. (Note: I haven’t tested all slide types.)

And we expect that, regardless of slide type, the page orientation will always be in Portrait, since that is what is observed when printing the presentation using PowerPoint.

I’ve observed this with both the Java and .NET versions. To note, I was using the latest version of the .NET library for this testing, but not the latest version of the Java library.

Is there any workaround for this within the API? Again it doesn’t appear we can override the page orientation from what I can tell. Or is this a bug in Aspose.Slides? Again, both the Java and .NET versions are exhibiting this behavior.

Thank you for describing the issue.

I am working on the issue and will get back to you as soon as possible.

Please share the following files and information:

  • sample presentation file
  • output PDF file
  • PDF file with the expected result (if it is possible)
  • code example that reproduces the problem
  • OS version on which the code was executed
  • Aspose.Slides version you used

You can zip the files and upload an archive here.

Specifically I was testing this with Aspose.Slides for .NET 23.3.1. It’s also reproducible with Aspose.Slides for Java 22.6 I’ve attached two PPTX files. “PowerPoint with Custom slide.pptx” produces the incorrect orientation in the PDF. “e. speaker notes.pptx” produces what we expect. PDF files are attached as well showing what Aspose.Slides produces.

PowerShell code that demonstrates the issue with Aspose.Slides for .NET:

Add-Type -Path .\Aspose.Slides.dll
$license = New-Object Aspose.Slides.License
$presentation = New-Object Aspose.Slides.Presentation('.\PowerPoint with Custom slide.pptx')
$presentation.Slides[0].LayoutSlide.LayoutType #This should output "Custom"
$pdfOptions = New-Object Aspose.Slides.Export.pdfOptions
$pdfOptions.NotesCommentsLayouting.NotesPosition = [Aspose.Slides.Export.NotesPositions]::BottomFull
$presentation.Save('.\PowerPoint with Custom slide.pdf', [Aspose.Slides.Export.SaveFormat]::Pdf, $pdfOptions)
$presentation = New-Object Aspose.Slides.Presentation('.\e. speaker notes.pptx')
$presentation.Slides[0].LayoutSlide.LayoutType #This should output "Title"
$presentation.Slides[1].LayoutSlide.LayoutType #This should output "TitleAndObject"
$presentation.Save('.\e. speaker notes.pdf', [Aspose.Slides.Export.SaveFormat]::Pdf, $pdfOptions)

Aspose (3.2 MB)

Thank you for the additional information. As far as I can see, Aspose.Slides produces the same result as PowerPoint. Please look at the following screenshots:
PowerPoint with Custom slide.png (126.4 KB)
e. speaker notes.png (73.2 KB)

And interestingly I’ve discovered that changing that orientation is considered a change to the presentation and PowerPoint prompts to save changes when closing it. And reopening the presentation after committing that change shows it’s a property embedded on the PowerPoint. Aspose.Slides also honors that property when converting to PDF.

So what is that property, and how can I access it through the Aspose.Slides API so it can be overridden on the fly? I’m digging through the documentation, but nothing obvious is standing out.

Thank you for your research. I am working on your question and will get back to you as soon as possible.

It looks like you can change the orientation for Notes Pages like this

using (var pres = new Presentation("PowerPoint with Custom slide.pptx"))
    var notesSize = pres.NotesSize.Size;
    pres.NotesSize.Size = new SizeF(notesSize.Height, notesSize.Width); // inverse

    pres.Save("output.pptx", SaveFormat.Pptx);

but this do not work correctly for the “PowerPoint with Custom slide.pptx” document.

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): SLIDESNET-43947

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.

As mentioned in my original message, the issue explained herein is also present in the Aspose.Slides for Java API, and likely in the other Aspose.Slides APIs as well. So have you noted that in the issue you’ve opened so it’s handled across the board?

When the issue is resolved in Aspose.Slides for .NET, it will be resolved for other programming languages as well.

@andrey.potapov is there any update on SLIDESNET-43947?

The issue is still open. Unfortunately, I don’t have any additional information. We apologize for any inconvenience caused.