我们如何在使用/不使用python的情况下将PDF转换为docx。实际上我想自动转换大量的文件,所以我需要一个API。
我使用过像这样的在线网站:https://pdf2docx.com/
https://online2pdf.com/pdf2docx
https://www.zamzar.com/convert/pdf-to-docx/
我无法直接访问使用那里的api
发布于 2021-01-28 14:27:02
pdf2docx
单击here,安装
Installation
pip安装pdf2docx或#下载软件包并安装您的环境python setup.py install
从pdf2docx导入转换器pdf_file = r'C:\Users\ABCD\Desktop\XYZ/Document1.pdf'#源文件docx_file = r'C:\Users\ABCD\Desktop\XYZ/sample.docx‘#目标文件# convert pdf to docx cv = Converter(pdf_file) cv.convert(docx_file,start=0,end=None) cv.close() #Output Parsing Page53: 53/53...正在创建第53页: 53/53...在6.258919400000195s.中终止
从pdf2docx导入解析pdf_file = r'C:\Users\ABCD\Desktop\XYZ/Document2.pdf‘# source file docx_file = r'C:\Users\ABCD\Desktop\XYZ/sample_2.docx’# destination file # convert pdf to docx parse(pdf_file,docx_file,start=0,end=None) # output Parsing Page53: 53/53...正在创建第53页: 53/53...在5.883666100000482s.中终止
发布于 2019-06-12 18:23:54
发布于 2019-06-13 18:39:27
我是Zamzar的首席技术官,我们在https://developers.zamzar.com/上有一个API可以做到这一点。
我们有a Test account,你可以免费使用来试用这项服务,还有our docs中的Python代码示例,它可以让你非常简单地将PDF文件转换为DOCX:
import requests
from requests.auth import HTTPBasicAuth
api_key = 'YOUR_API_KEY'
endpoint = "https://sandbox.zamzar.com/v1/jobs"
source_file = "/tmp/my.pdf"
target_format = "docx"
file_content = {'source_file': open(source_file, 'rb')}
data_content = {'target_format': target_format}
res = requests.post(endpoint, data=data_content, files=file_content, auth=HTTPBasicAuth(api_key, ''))
print res.json()然后,您可以在downloading your converted file之前使用poll the job查看它何时完成。
https://stackoverflow.com/questions/56559796
复制相似问题