From 1a086321c103a720c02eb7004f399e3c98a1bff0 Mon Sep 17 00:00:00 2001 From: pjp8glqzm <3795440669@qq.com> Date: Mon, 20 Jan 2025 18:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PDF_test.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 PDF_test.cpp diff --git a/PDF_test.cpp b/PDF_test.cpp new file mode 100644 index 0000000..33db591 --- /dev/null +++ b/PDF_test.cpp @@ -0,0 +1,31 @@ +// 包含 PDFReader 头文件 +#include "PDFReader.h" + +int main() { + // 定义 PDF 文件路径 + std::string filePath = "assets/example.pdf"; + + // 创建 PDFReader 对象并打开文件 + PDFReader reader(filePath); + + // 解析并打印 PDF 头部信息 + std::cout << "PDF 头部: " << reader.parseHeader() << std::endl; + + // 解析交叉引用表 (XRef Table),用于对象索引 + reader.parseXRefTable(); + + // 提取 PDF 中的图片 (JPEG, DCTDecode) + reader.extractImages(); + + // 解析 FlateDecode (压缩流) 并解压 + reader.parseFlateDecode(); + + // 解析 PDF 文件中的表格信息 + reader.parseTables(); + + // 渲染 PDF 页面 + reader.renderPDF(); + + // 返回 0 表示程序成功执行 + return 0; +}