python代码将PDF表转换为CSV文件

时间:2019-07-25 10:17:44

标签: python pdf extraction

我们要使用python将表从PDF文件提取为CSV。

我们已经尝试过使用Tabula和camelot软件包提取具有边界线的表格,但是我们正在搜索以识别pdf文件中没有边框的表格。

tabula.convert_into(inputFile, OFile, output_format='csv', pages="all")
t1 = camelot.read_pdf(inputFile, pages='all')
pdf_pages = len(t1)
list_of_df = []
for no_of_page in range(0, pdf_pages):
    list_of_df.append(pd.DataFrame(t1[no_of_page].df))
CSVFile = pd.concat(list_of_df)
OFile = (current_directory + pdf.replace('.pdf', '_camelot.csv'))
CSVFile.to_csv(OFile)

0 个答案:

没有答案