博客
关于我
python办公自动化之word转换pdf
阅读量:659 次
发布时间:2019-03-15

本文共 571 字,大约阅读时间需要 1 分钟。

学习目标:

1.学会word转换pdf

学习内容:

1.学会word转换pdf

学习时间:

2021-03-29 20:30


学习产出:

1.安装 pywin32模块

pip install pywin32

在这里插入图片描述

参考文档:

2.代码记录

#参考文档:https://docs.microsoft.com/zh-cn/office/vba/api/word.document.exportasfixedformat

from  win32com.client import  constants,gencachedef createPdf(wordPath,pdfPath):    word = gencache.EnsureDispatch('Word.Application')    doc = word.Documents.Open(wordPath,ReadOnly =1)    #进行抓换    doc.ExportAsFixedFormat(pdfPath,constants.wdExportFormatPDF)    word.Quit()    returncreatePdf('D:/pythonStudy/base/word/info.docx','D:/pythonStudy/base/word/info.pdf')

在这里插入图片描述

转载地址:http://novmz.baihongyu.com/

你可能感兴趣的文章
MySQL 聚簇索引&&二级索引&&辅助索引
查看>>
Mysql 脏页 脏读 脏数据
查看>>
mysql 自增id和UUID做主键性能分析,及最优方案
查看>>
Mysql 自定义函数
查看>>
mysql 行转列 列转行
查看>>
Mysql 表分区
查看>>
mysql 表的操作
查看>>
mysql 视图,视图更新删除
查看>>
MySQL 触发器
查看>>
mysql 让所有IP访问数据库
查看>>
mysql 记录的增删改查
查看>>
MySQL 设置数据库的隔离级别
查看>>
MySQL 证明为什么用limit时,offset很大会影响性能
查看>>
Mysql 语句操作索引SQL语句
查看>>
MySQL 误操作后数据恢复(update,delete忘加where条件)
查看>>
MySQL 调优/优化的 101 个建议!
查看>>
mysql 转义字符用法_MySql 转义字符的使用说明
查看>>
mysql 输入密码秒退
查看>>
mysql 递归查找父节点_MySQL递归查询树状表的子节点、父节点具体实现
查看>>
mysql 通过查看mysql 配置参数、状态来优化你的mysql
查看>>