更新时间:2023-02-20 10:38:48
当我查看你的代码时,我看到很多奇怪的东西。
When I look at your code, I see a number of things that are odd.
BaseFont.CP1252 $ c创建一个 BaseFont
对象$ c>而不是 BaseFont.IDENTITY_H
(这是使用Unicode时所需的编码)。
BaseFont.EMBEDDED
参数!段落
,这是一种不知道如何渲染é,è,à的字体... BaseFont
object using BaseFont.CP1252
instead of BaseFont.IDENTITY_H
(which is the "encoding" you need when you work with Unicode).BaseFont.EMBEDDED
parameter is ignored in this case!Paragraph
that is created using the default font "Helvetica", a font that doesn't know how to render é,è,à...要解决此问题,您需要使用适当的字体创建段落
。这是 NOT 标准的1型字体,但类似 courier.ttf
。您还需要使用适当的编码: BaseFont.IDENTITY_H
。
To solve this, you need to create the Paragraph
with the appropriate font. That is NOT a standard type 1 font, but something like courier.ttf
. You also need to use the appropriate encoding: BaseFont.IDENTITY_H
.