#!/usr/bin/python2.6 # -*- coding: utf-8 -*- # pip install timeout-decorator import os import win32com.client # wps使用的是wps2016版本 # 转换 Word文件档到pdf def ConvertDocToPdf(src, dst): if not os.path.exists(src): print(src + "不存在,无法继续!") return False os.system('taskkill /im wps.exe') # 如果文件存在就删除 if os.path.exists(dst): os.remove(dst) o = win32com.client.Dispatch("Kwps.Application") o.Visible = False doc = o.Documents.Open(src); doc.ExportAsFixedFormat(dst, 17) o.Quit(); if os.path.exists(dst): return True else: return False # 转换 Ppt文件档到pdf def ConvertPptToPdf(src, dst): if not os.path.exists(src):