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()
相关推荐
Source.Liu1 小时前
【A11】基于 PDF 渲染引擎的统一文档界面架构设计
rust·pdf
AI英德西牛仔3 小时前
秘塔 导出word指令之外:AI导出鸭电脑版的底层逻辑与批量交付哲学
人工智能·word·excel·deepseek·ai导出鸭
2601_963906785 小时前
[特殊字符] DocxTableExport:一键提取 Word 文档中的表格数据
word·软件需求
yivifu5 小时前
解决word文档中行尾中文破折号被分断的问题
word
wujian83116 小时前
豆包导出word手机,就用AI导出鸭:一站式批量导出方案深度解析
人工智能·ai·chatgpt·智能手机·word·ai导出鸭
zhonyu鱼1 天前
Saber:专为触控笔设计的开源手写笔记与 PDF 批注工具
笔记·pdf·开源
AI导出鸭PC端1 天前
文心怎样生成word文档?一键智能排版,AI导出鸭解决格式错乱痛点
人工智能·ai·word·豆包·deepseek·ai导出鸭
winfredzhang1 天前
用 Python + wxPython 造一个照片工具箱:PDF / 加密ZIP / MP4 / 归档,以及我在这过程中踩到的 4 个坑
python·pdf·zip·mp4·移动
2501_930707782 天前
使用C#代码在 PDF 文档中创建列表
pdf
AI导出鸭2 天前
Claude的LaTeX生成PDF文件复制后数学公式乱码,怎样修改?专业用户首选“AI导出鸭”
人工智能·pdf·ai导出鸭