我想用pdfbox显示pdf的阿拉伯语文字?

时间:2012-05-28 01:43:35

标签: java pdf arabic pdfbox

它显示字母但按阿拉伯语的相反顺序我使用以下代码

  PDDocument pddDocument = PDDocument.load(new File("test1.pdf"));
        PDFTextStripper textStripper = new PDFTextStripper();

        TextNormalize normalize = new TextNormalize("UTF-8");
        String Text = textStripper.getText(pddDocument);

      Text=normalize.makeLineLogicalOrder(Text, true);
      Text = normalize.normalizePres(Text);
      Text = normalize.normalizeDiac(Text);
        System.out.println(Text);

1 个答案:

答案 0 :(得分:5)

http://site.icu-project.org/download/49#TOC-ICU4J-Download下载icu4j-49_1.jar并将其放入类路径

解决了这个问题

然后重写代码如下

PDDocument pddDocument = PDDocument.load(new File("test1.pdf"));
            PDFTextStripper textStripper = new PDFTextStripper();
            String Text = textStripper.getText(pddDocument);
            System.out.println(Text);