【发布时间】:2017-08-03 18:04:37
【问题描述】:
我有这个方法可以提取pdf中特定位置的文本
public static void getTextByRectangle(PDDocument doc,Rectangle rect) throws IOException{
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition( true );
stripper.addRegion( "class1", rect );
PDPage firstPage = doc.getPage(0);
stripper.extractRegions( firstPage );
System.out.println( "Text in the area:" + rect );
System.out.println( stripper.getTextForRegion( "class1" ) );
}
除了提取图像之外,是否可以做同样的事情?
【问题讨论】: