Comtypes客户Powerpoint。应用程序问题

时间:2018-11-19 16:44:27

标签: python-3.x pdf powerpoint python-pptx comtypes

我正在尝试将使用pptx python软件包创建的Power Point(.pptx)转换为.pdf文件,并且正在使用以下代码:

  import comtypes.client
进口商品

def PPTtoPDF(inputFileName,outputFileName,formatType = 32):
      powerpoint = comtypes.client.CreateObject(“ Powerpoint.Application”)#
      comtypes.client.CreateObject('Powerpoint.Application')
      powerpoint.Visible = 1

      如果outputFileName [-3:]!='pdf':
         outputFileName = outputFileName +“ .pdf”
      卡座= powerpoint.Presentations.Open(inputFileName)
      deck.SaveAs(outputFileName,formatType)
      deck.Close()
      powerpoint.Quit()


PPTtoPDF('test.pptx','test.pdf',formatType = 32)
 

我已从Stack Overflow的另一篇讨论中摘录。 运行此代码时,出现以下错误:

  OSError:[WinError -2147221005]无效的类字符串
 

我正在Windows 7计算机(64位Service Pack 1)上运行。

有人知道问题出在哪里,我该如何解决?

一如既往,非常感谢您的帮助!

0 个答案:

没有答案