You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
669 B
30 lines
669 B
#ifndef PDFREADER_H
|
|
#define PDFREADER_H
|
|
#include <string>
|
|
#include<vector>
|
|
|
|
class PDFReader {
|
|
public:
|
|
// 构造函数,传入 PDF 文件路径
|
|
PDFReader(const std::string& filepath);
|
|
|
|
// 提取所有页面的文本
|
|
std::string extractText();
|
|
|
|
private:
|
|
std::vector<char> fileData; // 存储 PDF 文件的二进制数据
|
|
|
|
// 加载 PDF 文件到内存
|
|
void loadFile(const std::string& filepath);
|
|
|
|
// 检查 PDF 文件是否有效
|
|
bool isPDFValid();
|
|
|
|
// 简单解析 PDF 文件,提取对象和文本
|
|
std::string parsePDF();
|
|
|
|
// 从内容流中提取文本数据
|
|
std::string extractTextFromStream(const std::string& streamContent);
|
|
};
|
|
|
|
#endif // PDFREADER_H
|