1
我有一个粘滞便笺的文件。如何使用PDFBox阅读粘滞便笺的内容?使用PDFBox提取粘滞便笺
我有一个粘滞便笺的文件。如何使用PDFBox阅读粘滞便笺的内容?使用PDFBox提取粘滞便笺
找到它。这是我的代码
PDDocument pdfFile;
PDFTextStripper stripper;
List allPages;
PDPage page;
List<PDAnnotation> la = new ArrayList<PDAnnotation>();
stripper = new PDFTextStripper();
File file = new File("C:\\Users\\idobles\\Desktop\\CFM\\6 402402424.pdf");
pdfFile = PDDocument.load(file);
allPages = pdfFile.getDocumentCatalog().getAllPages();
for(int i = 0; i < allPages.size(); i++){
page = (PDPage) allPages.get(i);
la = page.getAnnotations();
if(la.size() < 1){
continue;
}
}
la对象应该有一个存储在地图中的项目列表。使用“内容”键,您可以在粘滞便笺中获得信息。希望这可以帮助别人!