from win32com
.client
import *
def switch_pdf(path
, name
):
'''
作用:将word文档转化为pdf文档
参数1:文件夹路径
参数2:文件名
'''
word
= gencache
.EnsureDispatch
('Word.Application')
f
= word
.Documents
.Open
(path
+ name
)
f
.ExportAsFixedFormat
(path
+ "hello.pdf", constants
.wdExportFormatPDF
)
word
.Quit
();
switch_pdf
("C:\\Users\\Administrator\\Desktop\\word文档\\" , "hello.doc")
运行效果图:
原 word 样式:
新 pdf 样式:
ExportAsFixedFormat() 转化方法的参数使用详情:
喜欢的点个赞❤吧!
转载请注明原文地址: https://lol.8miu.com/read-22992.html