iText无法使用java正确提取灌木文本
我想从pdf文件中提取Shurti文本并编写新的pdf。我正在使用 iText但是它不能提取正确的文本,那么解决方法是什么呢 我正在使用iText 5.4 lib进行此操作 iText以新的pdf'、''-''、''和空白的Shurti字体显示iText无法使用java正确提取灌木文本,java,pdf,text,itext,Java,Pdf,Text,Itext,我想从pdf文件中提取Shurti文本并编写新的pdf。我正在使用 iText但是它不能提取正确的文本,那么解决方法是什么呢 我正在使用iText 5.4 lib进行此操作 iText以新的pdf'、''-''、''和空白的Shurti字体显示 Code That I am Using is, //for extract text From pdf try { PdfReader pdfreader = new PdfReader(file path,password);
Code That I am Using is,
//for extract text From pdf
try {
PdfReader pdfreader = new PdfReader(file path,password);
String iTextContent = PdfTextExtractor.getTextFromPage(pdfreader,1);
} catch (IOException ex) {
Logger.getLogger(JFileChooserDemo.class.getName()).log(Level.SEVERE, null, ex);
}
//write new pdf file
try{
Document docNew = new Document();
PdfWriter writer = PdfWriter.getInstance(docNew,new FileOutputStream("D:\\demo.pdf"));
docNew.open();
BaseFont bf = BaseFont.createFont("D:\\DeskTop\\Pdf Box jar\\shruti.ttf", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
Font f = new Font(bf,5);
docNew.add(new Paragraph(newStr,f));
docNew.close();
writer.close();
}catch(Exception e){
e.printStackTrace();
}
请共享您的PDF。请共享您的PDF。