如何使用Java確定PDF頁面是包含文本還是純圖片?確定PDF頁面是包含文本還是純圖片
我搜索了很多論壇和網站,但我還找不到答案。
是否可以從PDF中提取文本,以瞭解頁面是否爲格式圖片或文本?
PdfReader reader = new PdfReader(INPUTFILE);
PrintWriter out = new PrintWriter(new FileOutputStream(OUTPUTFILE));
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
// here I want to test the structure of the page !!!! if it's possible
out.println(PdfTextExtractor.getTextFromPage(reader, i));
}
這看起來很相關。也許你需要在這裏得到賞金 – Coffee
謝謝Adel先生,我希望如此:) –