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()
相关推荐
Eternity_GQM16 小时前
【Word VBA Zotero 引用宏错误分析与改正指南】【解决[21–23]参考文献格式插入超链接问题】
开发语言·c#·word
代码AI弗森21 小时前
PDF OCR + 大模型:让文档理解不止停留在识字
pdf·ocr
小周同学:2 天前
在 Vue2 中使用 pdf.js + pdf-lib 实现 PDF 预览、手写签名、文字批注与高保真导出
开发语言·前端·javascript·vue.js·pdf
Kyln.Wu2 天前
【python实用小脚本-187】Python一键批量改PDF文字:拖进来秒出新文件——再也不用Acrobat来回导
python·pdf·c#
小付同学呀2 天前
word——删除最后一页空白页
word
我在北国不背锅2 天前
基于Java的Markdown转Word工具(标题、段落、表格、Echarts图等)
java·word·echarts·markdown
全宇宙最最帅气的哆啦A梦小怪兽2 天前
【word】一次选中全部表格,宏方法
word
迪尔~3 天前
Apache POI中通过WorkBook写入图片后出现导出PDF文件时在不同页重复写入该图片问题,如何在通过sheet获取绘图对象清除该图片
java·pdf·excel
忆~遂愿3 天前
Python实战教程:PDF文档自动化编辑与图表绘制全攻略
python·pdf·自动化
Rust语言中文社区4 天前
简单好用的在线工具:轻松把图片添加到 PDF
pdf