ExportAsFixedFormat() 转化方法的参数使用详情

# -*- coding: UTF8 -*-
from win32com.client import *

def switch_pdf(path, name):
    '''
     作用:将word文档转化为pdf文档
     参数1:文件夹路径
     参数2:文件名
    '''
    # 创建word程序对象
    word = gencache.EnsureDispatch('Word.Application')
    # 读取word文件
    f = word.Documents.Open(path + name)
    # 转化为word文件
    f.ExportAsFixedFormat(path + "hello.pdf", constants.wdExportFormatPDF)
    # 退出程序
    word.Quit();
    
switch_pdf("C:\\Users\\Administrator\\Desktop\\word文档\\" , "hello.doc")