You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何提取PDF矩形框内数据并导出为带对应行列的CSV文件?

提取PDF矩形框内数据并导出为带行列的CSV文件求助

我需要提取PDF中矩形框内的数据,并导出为保留对应行列结构的CSV文件。先后尝试了Camelot、PyPDF2、Tabula等库,但都没能得到符合预期的CSV输出结果,希望能得到解决办法。

附PDF中矩形框数据截图:
PDF矩形框内数据截图

相关PDF文件已准备就绪,以下是我尝试过的代码:

import PyPDF2
pdf_file_obj = open('Rectangle_Box_PDF_2021_v2.pdf', 'rb')
pdf_read = PyPDF2.PdfFileReader(pdf_file_obj)
print("The total number of pages : " +str(pdf_read.numPages))
page_obj = pdf_read.getPage(0)
cont = []
pdf_list = [page_obj.extractText()]
print(pdf_list)
list1 = []
pdf_list = [page_obj.extractText()]
for i in range(0, len(pdf_list)):
    list1.append(pdf_list[i].split('\n'))
flatList = sum(list1, [])
print(flatList)

内容的提问来源于stack exchange,提问作者Mech_Saran

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 13:41:01