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()
相关推荐
黑咩狗夜.cm9 小时前
(aspose.words .net)内容分别固定在一行左右俩端
c#·word·.net
w20180014 小时前
一至六年级下册数学第五单元测试卷(人教版+苏教版)
pdf
E_ICEBLUE15 小时前
如何提取 Word 文档中的表格并导出为 Excel(Python 教程)
python·word·excel
IT策士16 小时前
Python Word操作:从入门到精通
python·c#·word
w20180016 小时前
人教版小学一至六年级下册语文期中考试试卷PDF可打印
pdf
aaaffaewrerewrwer17 小时前
一个功能非常完整的在线 Word Search Puzzle(单词搜索)网站推荐:支持自定义出题、打印与多语言
游戏·word·个人开发
w20180018 小时前
小学一至六年级下册数学期中考试试卷PDF(人教版+苏教版+冀教版+北师版)
pdf
yivifu19 小时前
使用PyMuPDF基于对PDF文档内容的分析自动识别并删除PDF文件中的水印
python·pdf·pymupdf·去水印
tanis_207720 小时前
PDF 解析后输出什么格式?MinerU 五类下游场景的选型指南
人工智能·pdf·csdn开发云
tanis_20771 天前
扫描版中文 PDF 怎么提取文字:用 MinerU 做 OCR + 结构化一体处理
人工智能·pdf·ocr