java 设置pdf 编码,Java PDFBOX文本编码

I try to export some data from my Java application to a pdf file. I decided to use the pdfBox library,but I realized that I could not do the Greek characters displayed properly into the pdf file. Is there a way to set the encoding? to utf8, or iso-8859-7? I try something like PdFontEncoding or Encoding but I did not get anything.

Thank you for your time.

解决方案

There are two things you would need to do:

set the encoding, and

provide a font with Greek characters

The inbuilt fonts that most PDF readers have (ie Adobe Reader, OS X Preview, etc) only have the latin1 encoding, which doesn't include Greek characters. See http://libharu.sourceforge.net/fonts.html

My guess is that problem here is not with the encoding, instead the problem is the font. You will need to obtain a font with Greek characters and embed it in the PDF file. Make sure you have a licence to embed the font!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值