首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用C++或Python将表格中的PDF数据转换为文本(或任何其他可读格式)文件

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

Stack Overflow用户
提问于 2021-09-18 07:25:18
回答 1查看 126关注 0票数 2

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

数据看起来是这样的,

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

我希望为程序处理这些数据,因此,我希望它在任何编程语言中都是可读的形式,最好是用C++或Python。

有人能指点我怎么做吗?也许我可以使用某个库来使用C++将这些数据转换为文本文件?

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

假设在C++中,我们有一个名为的类(一个对象将表示每个节,例如“BCS-1A”的对象或"BCS-7E“对象等等)。

所以,对于BCS-1A

代码语言:javascript
复制
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 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-18 13:58:59

我编写了一个存储库 on GitHub

我首先使用pdf2image将pdf转换成图像文件,并将这些文件存储在图像文件夹中。

然后使用pytesseract将这些图像转换为txt文件,并将这些txt文件存储在texts文件夹中。

之后,我对文本进行了一些格式化,并以csv格式存储在csvs文件夹中。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69232521

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档