python - Error using comtypes.client to convert a .pptx file into .pdf -
i'm trying convert .pptx file pdf file. far got:
pp_format_pdf = 32 def _convert_powerpoint2pdf(input_path, output_path): try: import comtypes import comtypes.client except importerror error: raise else: powerpoint = slides = none try: comtypes.coinitialize() powerpoint = comtypes.client.createobject('powerpoint.application') slides = powerpoint.presentations.open(input_path) slides.saveas(output_path, fileformat=pp_format_pdf) except windowserror error: raise except comtypes.comerror error: raise ioerror(error) finally: slides , slides.close() powerpoint , powerpoint.quit() comtypes.couninitialize()
error:
traceback (most recent call last): file "c:/users/mathias/git/pdfconv/tests\test_converter.py", line 89, in test_convert_presentation2pdf_pptx pdfconv.converter.convert_presentation2pdf(input_path, output_path) file "c:\users\mathias\git\pdfconv\pdfconv\converter.py", line 116, in convert_presentation2pdf _convert_powerpoint2pdf(input_path, output_path) file "c:\users\mathias\git\pdfconv\pdfconv\converter.py", line 179, in _convert_powerpoint2pdf slides.saveas(output_path, fileformat=pp_format_pdf) _ctypes.comerror: (-2147467259, 'unbekannter fehler', (u'presentation (unknown member) : powerpoint kann ^0 auf ^1 nicht speichern.', u'microsoft powerpoint 2013', u'', 0, none))
almost same code works fine word , excel. has idea doing wrong?
Comments
Post a Comment