私はtelufu pdfにpdfを持っています(anils.comを123.176.47.55に置き換えます)そのpdfからテキストを抽出したい(そのpdfページのように、読む必要のある3番目のブロックデータはありません)そのために、そのページのすべてのフォントをダウンロードしますmupdf-1.3-windows
PDFが使用するすべてのフォントをダウンロードしますが、それらのフォントを使用してそのテキストを別のPDFに書き込むと、コードが再編集されていないテキストの一部が次のようになります
//output file name
public static String pdf1 = "C:\\Documents and Settings\\Administrator\\Desktop\\itextpdf\\anil.pdf";
public static void main(String[] args) throws IOException, DocumentException {
try {
PdfReader reader = new PdfReader(new URL("http://anils/DraftRolls/PDFGeneration.aspx?urlPath=D%3a\\SSR_2013_FINAL+ROLLS\\AC_238\\Telugu\\S01A238P038.PDF"),null);
System.out.println("This PDF has "+reader.getNumberOfPages()+" pages.");
// reading page no 3
String page = PdfTextExtractor.getTextFromPage(reader, 3);
// all fonts I had checked total of 7 fonts but I didn't get all the fonts
BaseFont f = BaseFont.createFont("C:\\Documents and Settings\\Administrator\\Desktop\\itextpdf\\fonts\\AAAAAD+Gautami-0174.ttf", "", BaseFont.EMBEDDED);
Font telugu = new Font(f, 18.0f, Font.BOLD);
Paragraph description = new Paragraph(page,telugu);
// description.setAlignment(Paragraph.ALIGN_CENTER);
Document document = new Document();
// step 2
PdfWriter.getInstance(document, new FileOutputStream(pdf1));
// step 3
document.open();
document.add(description);
document.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
一部のテキストはどのフォントにも一致しませんでした。これを解決するにはどうすればよいですか?