跳至主要內容

图像分析器

xsx小于 1 分钟高级功能分析器

说明

可解析图像相关信息,包含内容如下:

  1. pageIndex(页面索引)
  2. pageWidth(页面宽度)
  3. pageHeight(页面高度)
  4. imageIndex(图像索引)
  5. imageType(图像类型)
  6. imageRealWidth(图像真实宽度)
  7. imageRealHeight(图像真实高度)
  8. imageDisplayWidth(图像显示宽度)
  9. imageDisplayHeight(图像显示高度)
  10. imagePosition(图像位置坐标)
  11. 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);
}
源文档
源文档
解析效果
解析效果