使用 C++ 或 Python 将表格 PDF 数据转换为文本(或任何其他可读格式)文件

Convert a Tabled PDF data into a text (or any other readable format) file using C++ or Python

我有一个 PDF 文件,其中包含大学时间表,由 aSc 时间表软件生成。

数据看起来像这样,

PDF 文件中大约有 29 个这样的页面。

我想为一个程序处理这些数据,因此,希望它以任何编程语言的可读形式出现,最好是 C++ 或 Python 语言。

谁能指导我该怎么做?也许我可以使用一些库将此数据转换为使用 C++ 的文本文件?

我需要的数据是这种形式,

假设在 C++ 中,我们有一个名为 Section 的 class(一个对象将代表每个部分,例如“BCS-1A”的对象或“BCS-7E”对象等)

所以,对于 BCS-1A

Section Object: 

section_name: "BCS-1A" // (section_name is a string data member)
// There will be 7 arrays, each representing one day of the week and each array will be of size 16. One index of the array will represent one time slot of that day. So, in this case, 

moday_schedule[16]; // it will be an **linked list** array of 16 size. Each index can be empty or may contain as many slots as possible. Each index represents the time slot in the timetable. For example "0th" index will represent the time slot of 8:45 to 9:15, 16th index will represent 4:15 to 4:40 and etc. 

// For example, monday_schedule[0] will be EMPTY.
// monday_schedule[4] will contain an object that will have following information,

// Subject: Digital Logic Design
// Teacher: Mirza Waqar Baig
// Sub-section: None (there is a sub-section in some lectures)
// Room: R-5

// monday_schedule[5] will also contain same information

// monday_schedule[12] will have two objects.
// and both the objects will have an attribute of "Sub-section" as well 

我在 GitHub

上整理了一个 repository

我使用 pdf2image 首先将 pdf 转换为图像文件并将这些文件存储在图像文件夹中。
然后使用 pytesseract 将这些图像转换为 txt 文件并将这些 txt 文件存储在文本文件夹中。
之后,我对文本进行了一些格式化,并将其以csv格式存储在csvs文件夹中。