评论分析器
2025/5/10大约 1 分钟pdfbox模块高级功能分析器
说明
可解析评论相关信息,包含内容如下:
- pageIndex(页面索引)
- pageWidth(页面宽度)
- pageHeight(页面高度)
- textContent(文本内容)
- textBeginPosition(文本起始位置坐标)
- textEndPosition(文本结束位置坐标)
- textWidth(文本宽度)
- textHeight(是否隐藏)
- isInvisible(是否不可见)
- isLocked(是否锁定)
- isLockedContents(是否锁定内容)
- isNoRotate(是否无旋转)
- isNoView(是否无视图)
- isNoZoom(是否无缩放)
- isPrinted(是否可打印)
- isReadOnly(是否只读)
- isToggleNoView(是否切换无视图)
示例(文档)
try (
// 加载文档
Document document = PdfHandler.getDocumentHandler().load("E:\\PDF\\pdfbox\\analyzer\\hello-world.pdf");
// 创建文档分析器
DocumentAnalyzer analyzer = new DocumentAnalyzer(document);
) {
// 解析评论信息(文档)
Set<CommentInfo> infoSet = analyzer.analyzeComment();
// 输出评论信息
infoSet.forEach(System.out::println);
}


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

