图像提取器
2025/7/21小于 1 分钟pdfbox模块高级功能提取器
示例
提取图像
说明
- 返回值为 map ,key 为页面索引, value 为提取图像
- 可根据页面索引进行提取
try (
// 加载文档
Document document = PdfHandler.getDocumentHandler().load("E:\\PDF\\pdfbox\\extractor\\hello-world.pdf");
// 获取文档提取器
DocumentExtractor extractor = PdfHandler.getDocumentExtractor(document);
) {
// 提取图像信息
Map<Integer, List<BufferedImage>> map = extractor.extractImage();
// 输出文本信息
map.forEach((key, value) -> System.out.println("第" + key + "页:" + value));
}