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

在使用PDFBox库从Java应用导出数据到PDF文件时遇到希腊字符显示不正常的问题。主要原因是内置字体不支持希腊字符。解决方法包括设置字体编码为UTF-8或ISO-8859-7,并嵌入包含希腊字符的字体到PDF中。确保已获得嵌入字体的许可。
摘要由CSDN通过智能技术生成

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!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值