Unable to save Arabic words in a PDF - PDFBox Java

前端 未结 2 1723
感情败类
感情败类 2021-01-18 09:17

Trying to save Arabic words in an editable PDF. It works all fine with English ones but when I use Arabic words, I am getting this exceptio

2条回答
  •  独厮守ぢ
    2021-01-18 10:02

    You need a font which supports those Arabic symbols.
    Once you've got a compatible font, you can load it using PDType0Font

    final PDFont font = PDType0Font.load(...);
    

    A Type 0 font is a font which references multiple other fonts' formats, and can, potentially, load all available symbols.

    See also the Cookbook - working with fonts (no examples with Type 0, but still useful).

提交回复
热议问题