簡體   English   中英

使用PDFBox提取便簽

[英]Extracting sticky notes using 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對象應具有存儲在地圖中的項目列表。 使用“內容”鍵可以在便箋內獲取信息。 希望這對某人有幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM