图像分析器
小于 1 分钟高级功能分析器
说明
可解析图像相关信息,包含内容如下:
- pageIndex(页面索引)
- pageWidth(页面宽度)
- pageHeight(页面高度)
- imageIndex(图像索引)
- imageType(图像类型)
- imageRealWidth(图像真实宽度)
- imageRealHeight(图像真实高度)
- imageDisplayWidth(图像显示宽度)
- imageDisplayHeight(图像显示高度)
- imagePosition(图像位置坐标)
- image(图像)
示例(文档)
try (
// 加载文档
Document document = PdfHandler.getDocumentHandler().load("E:\\PDF\\pdfbox\\analyzer\\hello-world.pdf");
// 创建文档分析器
DocumentAnalyzer analyzer = new DocumentAnalyzer(document);
) {
// 解析图像信息(文档)
Set<ImageInfo> infoSet = analyzer.analyzeImage();
// 输出图像信息
infoSet.forEach(System.out::println);
}


示例(页面)
try (
// 加载文档
Document document = PdfHandler.getDocumentHandler().load("E:\\PDF\\pdfbox\\analyzer\\hello-world.pdf");
// 创建文档分析器
DocumentAnalyzer analyzer = new DocumentAnalyzer(document);
) {
// 解析图像信息(指定页面)
Set<ImageInfo> infoSet = analyzer.analyzeImage(0);
// 输出图像信息
infoSet.forEach(System.out::println);
}

