comtypes icon indicating copy to clipboard operation
comtypes copied to clipboard

Problem saving PowerPoint files as PDFs

Open petgriffin opened this issue 6 years ago • 2 comments

Hi

I have a similar issue to this one (comtypes 1.1.7):

https://github.com/enthought/comtypes/issues/129

My code snippet is

import comtypes.client

ppFormatPDF = 32

for fname in ["test1", "test2"]: in_file = fname + ".pptx"
out_file = fname + ".pdf" app = comtypes.client.CreateObject('Powerpoint.Application') ppt = app.Presentations.Open(in_file) ppt.SaveAs(out_file, FileFormat=ppFormatPDF) ppt.Close() app.Quit()

This seems to work OK saving test1.pptx as a PDF but trying to save the next one results in this error:

ppt.SaveAs(out_file, FileFormat=ppFormatPDF) _ctypes.COMError: (-2147188720, None, ('Presentation (unknown member) : Object does not exist.', 'Microsoft PowerPoint', '', 0, None))

Would appreciate any thoughts you may have - thanks!

petgriffin avatar Jan 25 '19 14:01 petgriffin

Seeing the exact same issue.

vidartrojenborg avatar Oct 04 '20 21:10 vidartrojenborg

Looks like language independent problem with PowerPoint COM interface usage. Guys could solve similar one (the same error code) with VBScript: https://stackoverflow.com/q/54508873/3648361

vasily-v-ryabov avatar Oct 08 '20 08:10 vasily-v-ryabov