fix:修复一些BUG
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
|
||||
import pythoncom
|
||||
import comtypes.client
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ def ppt_to_pdf_single(ppt_path, pdf_path=None):
|
||||
:param ppt_path: PPT 文件路径
|
||||
:param pdf_path: PDF 输出路径 (可选,默认同名)
|
||||
"""
|
||||
# 子线程初始化 COM 组件
|
||||
pythoncom.CoInitialize()
|
||||
ppt_path = os.path.abspath(ppt_path) # COM 接口必须使用绝对路径
|
||||
|
||||
if pdf_path is None:
|
||||
@@ -40,3 +42,4 @@ def ppt_to_pdf_single(ppt_path, pdf_path=None):
|
||||
finally:
|
||||
if powerpoint:
|
||||
powerpoint.Quit()
|
||||
pythoncom.CoUninitialize()
|
||||
|
||||
Reference in New Issue
Block a user