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()
相关推荐
不坑老师2 小时前
利用不坑盒子的Copilot,快速排值班表
microsoft·word·powerpoint·excel·copilot·wps
开开心心就好5 小时前
批量PDF转换工具,一键转换Word Excel
开发语言·前端·学习·pdf·电脑·word·excel
老家的回忆18 小时前
jsPDF和html2canvas生成pdf,组件用的elementplus,亲测30多页,20s实现
前端·vue.js·pdf·html2canvas·jspdf
Vertira18 小时前
pdf 合并 python实现(已解决)
前端·python·pdf
十一0829931 天前
【PDF-XSS攻击】springboot项目-上传文件-解决PDF文件XSS攻击
spring boot·pdf·xss
qq_393828221 天前
PDF的图片文字识别工具
windows·pdf·电脑·软件需求·图片处理
RainSerein1 天前
Laravel8中使用phpword生成word文档
word·php·laravel
qq_393828221 天前
办公文档批量打印器 Word、PPT、Excel、PDF、图片和文本,它都支持批量打印。
windows·word·powerpoint·excel·软件需求
wsxqaz1 天前
浏览器原生控件上传PDF导致hash值不同
算法·pdf·哈希算法
工业3D_大熊11 天前
3D模式格式转换工具HOOPS Exchange如何将3D PDF转换为STEP格式?
3d·pdf·3d格式转换·3d模型格式转换·cad格式转换·cad数据格式转换·3d模型可视化