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()
相关推荐
小周同学:8 小时前
Vue项目中将界面转换为PDF并导出的实现方案
javascript·vue.js·pdf
我命由我123458 小时前
Excel - Excel 列出一列中所有不重复数据
经验分享·学习·职场和发展·word·powerpoint·excel·职场发展
archko12 小时前
android pdf框架-15,mupdf工具与其它
android·pdf
东方芷兰13 小时前
LLM 笔记 —— 08 Embeddings(One-hot、Word、Word2Vec、Glove、FastText)
人工智能·笔记·神经网络·语言模型·自然语言处理·word·word2vec
东风西巷16 小时前
MobiPDF安卓版(PDF阅读编辑工具) 修改版
学习·pdf·电脑·软件需求
qq_2052790516 小时前
Unity 项目外部浏览并读取PDF文件在RawImage中显示,使用PDFRender插件
pdf
E_ICEBLUE18 小时前
Python 处理 Word 文档中的批注(添加、删除)
开发语言·python·microsoft·word
郑..方..醒21 小时前
java实现ofd转pdf
java·pdf
_小许_1 天前
Go语言实现HTML转PDF
golang·pdf·html
睿思达DBA_WGX2 天前
使用 python-docx 库操作 word 文档(2):在word文档中插入各种内容
python·word