word转换为pdf
from win32com import client
w = client.Dispatch("Word.Application")
doc = w.Documents.Open('d:\\temp\\a.docx')
doc.ExportAsFixedFormat('D:\\temp\\word.pdf', client.constants.wdExportFormatPDF)
w.Quit()
excel转换为pdf
from win32com import client
xlApp = client.Dispatch("Excel.Application")
books = xlApp.Workbooks.Open('d:\\temp\\test.xlsx')
books.ExportAsFixedFormat(0, 'D:\\temp\\excel.pdf')
xlApp.Quit()
ppt转换为pdf
from win32com import client
p = client.Dispatch("PowerPoint.Application")
ppt = p.Presentations.Open('d:\\temp\\2017-08-04 Cirrus V3.0 Request.pptx', False, False, False)
ppt.ExportAsFixedFormat('D:\\temp\\ppt.pdf', 2, PrintRange=None)
p.Quit()