public class Urls {
public static void main(String[] args) throws IOException {
URL url=new URL("file:///C:/Users/SH-B/Desktop/0.pdf");
readPdf(url);//直接读全PDF面
}
public static void readPdf(URL url){
String pageContent = "";
try {
PdfReader reader = new PdfReader(url);
int pageNum = reader.getNumberOfPages();
for(int i=1;i<=pageNum;i++){
pageContent += PdfTextExtractor.getTextFromPage(reader, i);//读取第i页的文档内容
}
// System.out.println(pageContent);
} catch (Exception e) {
e.printStackTrace();
}finally{
}
}
}
itext读取pdf所有的数据
猜你喜欢
转载自blog.csdn.net/weixin_42666837/article/details/84949790
今日推荐
周排行