简体   繁体   English

使用PDFBox提取便签

[英]Extracting sticky notes using PDFBox

I've a file that has a sticky note. 我有一个带有粘滞便笺的文件。 How can I read the content of the sticky note using PDFBox? 如何使用PDFBox读取便笺的内容?

Found it. 找到了。 Here's my code 这是我的代码

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;
    }
}

The la object should have a list of items stored in a map. la对象应具有存储在地图中的项目列表。 Using the "content" key you get the information inside the sticky note. 使用“内容”键可以在便笺内获取信息。 Hope this helps someone! 希望这对某人有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM