[英]Thoroughly cofused about using .doc APIs
Let me start off by saying my python knowledge is beginner-to-intermediate level, and I recently started using the language again after a long time. 首先,我要说我的python知识是初学者到中级的水平,最近很长时间之后我又重新开始使用该语言。
This morning I came across a bunch of word documents I wanted to convert and concatenate to PDF files, with 2 .doc files creating one PDF. 今天早上,我遇到了很多我想转换并连接成PDF文件的Word文档,其中2个.doc文件创建了一个PDF。 seemed like a fairly trivial task, so I figured I'd try to learn how to do it in python. 似乎是一个相当琐碎的任务,所以我想我将尝试学习如何在python中进行操作。 concatenating PDFs wasn't too bad, I found PyPDF2 and managed to write a script that did just that. 连接PDF还不错,我找到了PyPDF2并设法编写了一个脚本来做到这一点。
But 7 hours later, after countless scripts with broken dependencies- I still can't find a way to automate the doc-pdf conversion . 但是7小时后,在无数依赖破坏的脚本之后,我仍然找不到自动化doc-pdf转换的方法 。
every script I found either: 我找到的每个脚本之一:
I know my question is hardly focused but honestly by now my brain is fried from information overload. 我知道我的问题几乎没有集中讨论,但老实说,现在我的大脑因信息超载而烦恼。 any simplifications for a noob would be more than welcome. 对于菜鸟的任何简化都将受到欢迎。
assuming no knowledge of COM stuff and little experience with any external frameworks: 假设不具备COM知识,并且没有任何外部框架的经验:
Thanks! 谢谢!
From my experience, converting between the various office formats is best done outside of python. 根据我的经验,最好在python之外完成各种办公格式之间的转换。 With the subprocess module, you can call the external command 使用子流程模块,您可以调用外部命令
soffice --convert-to pdf file.doc --headless
where soffice is the command that comes with LibreOffice. soffice是LibreOffice随附的命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.