Skip to content

Instantly share code, notes, and snippets.

@shonenada
Created December 21, 2013 16:26
Show Gist options
  • Save shonenada/8071601 to your computer and use it in GitHub Desktop.
Save shonenada/8071601 to your computer and use it in GitHub Desktop.
import os
import sys
import comtypes.client
def main():
in_file = os.path.abspath(sys.argv[1])
out_file = os.path.abspath("%s.pdf" % sys.argv[1])
try:
powerpoint_application = comtypes.client.CreateObject('Powerpoint.Application')
powerpoint_application.Visible = True
ppt = powerpoint_application.Presentations.Open(in_file)
ppt.SaveAs(out_file, FileFormat=32)
except Exception, e:
print e
finally:
ppt.Close()
powerpoint_application.Quit()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment