我想要使用Apache PDFBox的1.8.4提取PDF文本 - 我的代码波纹管:使用Apache PDFBox提取出错文字的文本?
public static void main(String[] args) throws Exception {
PDDocument pdfDocument = PDDocument.load(new File("rep.pdf"));
PDFTextStripper stripper = new PDFTextStripper();
String s = stripper.getText(pdfDocument);
System.out.println(s);
pdfDocument.close();
}
PDF它要转换:https://www.dropbox.com/s/t35rr23v4383yvt/Form-V-report.pdf?dl=0
但有这样charecters:
!"#$%&'()*$+,)!'-,./+/
0+12)3$#'(,,)451#+('1)65+7(,+'(/
!"#$%&'(
)*+,-.##(',/$.0
123.4.5,67,,89:;+
<3$'(=,>:++?,*99%@AB)
任何解决方案?
提前 - 谢谢。
读https://pdfbox.apache.org/1.8/faq.html#gibberish。顺便说一句,你的版本已经过时了。 (尽管当前版本无法提取文本) –