PDF转WORD

无环境的,windows可下载可执行文件:https://download.csdn.net/download/shfei10100/88588106

有python运行环境的,可自行运行;

代码如下:

python 复制代码
from pdf2docx import Converter

import tkinter as tk
from tkinter import filedialog
def pdf2word(file_path):

    # 截取文件名称
    file_name = file_path.split('.')[0]

    # 转换后的文件名称
    doc_file = f'{file_name}.docx'

    # 创建Converter对象
    p2w = Converter(file_path)

    # 执行转换方法,start开始页,0从第一页开始,end结束页,None为无限制
    p2w.convert(doc_file, start=0, end=None)
    p2w.close()
def select_file():
    # 单个文件选择
    selected_file_path = filedialog.askopenfilename() # 使用askopenfilename函数选择单个文件
    select_path.set(selected_file_path)

# pdf2word(r"../1.pdf")
if __name__ == "__main__":
    # 获取选择文件路径
    # 实例化
    root = tk.Tk()
    root.geometry('300x100')
    root.config(bg='#fffcc0')
    root.title("Pdf2Word")
    select_path = tk.StringVar()
    tk.Label(root, text="文件路径:").grid(column=0, row=0, rowspan=3)
    e1 = tk.Entry(root, textvariable=select_path)
    e1.grid(column=1, row=0, rowspan=3)
    tk.Button(root, text="选择文件", command=select_file).grid(row=0, column=2,columnspan=2)
    tk.Button(root, text="生成文件", command=lambda: pdf2word(e1.get())).grid(row=3, column=0, columnspan=2)
    tk.Button(root, text="退出", command=root.destroy).grid(row=3, column=3, columnspan=2)
    root.mainloop()
相关推荐
鲲穹AI种草18 小时前
PDF 文档多格式转换处理,多款 PDF 处理工具能力客观记录
pdf·文档格式转换
Felicia-侧听1 天前
PDF怎么转换成OFD?在线PDF转OFD方法
pdf·pdf转换·ofd·电子发票·文件格式转换·pdf转ofd·ofd格式
古少侠1 天前
用 DS随心转 把 AI 画的 Mermaid 流程图转成 Word 里的高清图
开发语言·c#·word
开开心心_Every2 天前
实现鼠标键盘动作录制与重复播放的工具
微信·jupyter·pycharm·pdf·计算机外设·word·excel
2601_962299492 天前
使用 Python 将 CSV 转为 PDF(含表格样式美化)
python·pdf·csv·spire.xls·表格样式
ZnS_oscar2 天前
不用下载字体,获得仿宋字体
windows·word
SunnyDays10112 天前
如何使用 Python 从 Word 文档中提取图片
python·word
tianyue1002 天前
PDFsam Basic PDF 分割、合并
pdf
SunnyDays10112 天前
如何使用 Python 给 PDF 添加附件:文档附件与附件注释
开发语言·python·pdf
SamChan902 天前
PDF翻译服务端到端基准测试:4款主流方案的吞吐量、延迟、内存占用对比
服务器·网络·python·ai·pdf·wpf