Convert .PPTX file into PDF file

1131580 pts.
Tags:
PDF
PPTX file
Python
I've been at this for several hours and nothing seems to be working! Is there any way to convert my .PPTX file into a .PDF file through Python? I tried using unoconv but it keeps giving me errors. What can I do?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try this

import sys  
import os  
import glob  
import win32com.client  
  
def convert(files, formatType = 32):  
    powerpoint = win32com.client.Dispatch("Powerpoint.Application")  
    powerpoint.Visible = 1  
    for filename in files:  
        newname = os.path.splitext(filename)[0] + ".pdf"  
        deck = powerpoint.Presentations.Open(filename)  
        deck.SaveAs(newname, formatType)  
        deck.Close()  
    powerpoint.Quit()  
  
files = glob.glob(r'PATH_TO_MY_PPTX') # <--- ONLY CHANGE  
convert(files)  

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Just curious as to why you don't just save it as a PDF from PowerPoint? Seems the easiest method.
    129,255 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: