Having Trouble Converting PPT to PDF with Aspose.Slides for Python

Hello Support Team,

I am having trouble converting PPT to PDF. I am able to run the code to load the ppt file into memory using

presentation = slides.Presentation("insert_location_here")

and view its properties, but every time I am saving it using

presentation.save("insert_pdf_name_here", slides.export.SaveFormat.PDF)

, it is giving me the file in the directory that has been corrupted.

My company has a Aspose.Total license and I run into the same issue when I do and don’t declare the license variable.

@ch.usai,

Could you please zip and attach your (input) PowerPoint presentation file to reproduce the issue on our end, we will check it soon.

linalg.zip (1.9 MB)

Thanks for the quick reply @amjad.sahi ! I have been successful doing the same thing with word files so it is really puzzling why aspose.Slides will simply not work for me.

I am able to view the object successfully in memory as it loads the right amount of images, and slides, and text, but corrupts when I saved it to PDF. Here is what I see when I try to edit it with notepad++

%PDF-1.7
%µµµµ

@ch.usai,

I tested your scenario/case using some newer version (e.g., Aspose.Slides for Java v23.10) and it works fine. I used the following sample code with your file to convert to PDF, the output PDF(attached) is fine tuned:
e.g.
Sample code:

com.aspose.slides.Presentation presentation = new com.aspose.slides.Presentation("f:\\files\\linalg.ppt");
presentation.save("f:\\files\\out1.pdf", com.aspose.slides.SaveFormat.Pdf); 

out1.pdf (2.1 MB)

Which version of the API you are using?

I am currently using Asposes.Slides for Python 23.12. Maybe I will try downgrading the version to v23.10?

pres = slides.Presentation("linalg.ppt")
pres.save("linalg.pdf", slides.export.SaveFormat.PDF)

Tried doing this with python library and I am still getting a corrupted save afterwards… very very odd.

@ch.usai,

Previously I tested with Aspose.Slides for Java v23.10 as I thought you are using Java library. Now I found you are using Asposes.Slides for Python via .NET v23.12. So, I now tested using your sample presentation file after installing Asposes.Slides for Python via .NET v23.12 and following sample code:
e.g.
Sample code:

import aspose.slides as slides

# Opening the presentation file by passing the file path to the constructor of Presentation class
pres = slides.Presentation("linalg.ppt")
pres.save("linalg.pdf", slides.export.SaveFormat.PDF)

it again works absolutely fine on my end, the output PDF is fine tuned and is not corrupted. Please find attached the output PDF file for your reference.
linalg.pdf (2.0 MB)

What is your environment (python version, OS, etc.), give us complete details? I am using python 3.11 on Window10.

I am using python 3.10.0 with Ubuntu release 20.04. Thank you for being so responsive.

I followed what you were doing Amjad, and ran it in my Windows 10/Python 3.10.0 and every works great. There might be some weird issue going on with Aspose and Ubuntu…

@ch.usai,
Thank you for the details. Could you please also share your output PDF file?

Hi Andrey,

Please find the pdf file here: linalg.zip (1.2 MB)

I know that I can remove the water mark but initializing the license. I have been doing this fine with aspose.word for word docs in the same ubuntu environment which makes it really odd.

@ch.usai,
Thank you for the PDF file. I am working on the issue and will get back to you soon.

@ch.usai,
Your output PDF document looks fine. Could you please describe what is wrong?

Hi Andrey,

That output is fine because I was running it out of my WSL environment in Windows 10 with Python version 3.10.0. I get this file when I do it within WSL environment with Python version 3.10.0 and Ubuntu release 20.04.
linalg.pdf (17 Bytes)

@ch.usai,
Unfortunately, I was unable to reproduce the problem. It looks like the issue is not related to Aspose.Slides for Python. Please try to isolate the problem and share additional information on how to reproduce the problem.