将 PDF 转换为 docx [英] Convert PDF to docx

查看:60
本文介绍了将 PDF 转换为 docx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用/不使用 python 将 PDF 转换为 docx.其实我想自动转换大量文件,所以我需要一个API.

How can we convert a PDF to docx with/without using python. Actually I want to automate conversion of large number of file, so I need an API.

我使用过以下在线网站:https://pdf2docx.com/

I have used online websites like: https://pdf2docx.com/

https://online2pdf.com/pdf2docx

https://www.zamzar.com/convert/pdf-to-docx/

我无法直接访问那里的 api

I was unable to get access for using there api directly

推荐答案

pdf2docx

  1. 安装 pdf2docx 包点击这里

安装

  • 克隆或下载 pdf2docx

  • Clone or download pdf2docx

 pip install pdf2docx
     or
 # download the package and install your environment
 python setup.py install 

  • 选项 1

  • Option 1

    from pdf2docx import Converter
    
    pdf_file  = r'C:\Users\ABCD\Desktop\XYZ/Document1.pdf'# source file 
    docx_file = r'C:\Users\ABCD\Desktop\XYZ/sample.docx'  # destination file
    
    # convert pdf to docx
    cv = Converter(pdf_file)
    cv.convert(docx_file, start=0, end=None)
    cv.close()
    
    #Output
    
    Parsing Page 53: 53/53...
    Creating Page 53: 53/53...
    --------------------------------------------------
    Terminated in 6.258919400000195s.
    

  • 选项 2

  • Option 2

    from pdf2docx import parse
    
    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 Page 53: 53/53...
    Creating Page 53: 53/53...
    --------------------------------------------------
    Terminated in 5.883666100000482s.
    

  • 这篇关于将 PDF 转换为 docx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆