使用java中的pdfbox API逐行从pdf中提取文本数据

时间:2015-01-28 07:39:03

标签: pdfbox

我曾经使用Apache PDFBox API从PDF中提取文本数据,但是下面的代码不是按顺序返回数据(逐行)

代码:

try {
            RandomAccess scratchFile = null;
            pdDoc = PDDocument.loadNonSeq(new File(fileName), scratchFile);
            pdfStripper = new PDFTextStripper();
            parsedText = pdfStripper.getText(pdDoc);
            system.out.println(parsedText);
        } catch (IOException e) {
            System.err.println("Unable to open PDF Parser. " + e.getMessage());
            return null;
        }

0 个答案:

没有答案
相关问题