[英]Modify the font of existing PDF in Itext
Can I modify the font of existing PDF. 我可以修改现有PDF的字体吗? I've some Type 3 (Custom) fonts with out any font descriptor.
我有一些Type 3(自定义)字体,没有任何字体描述符。 I would like to replace those to some meaningful Font.
我想将它们替换为一些有意义的字体。 How can I do this using Itext or PDFBox ?
如何使用Itext或PDFBox做到这一点?
A Type3 font is also known as a user defined font . Type3字体也称为用户定义字体 。 Characters such as
a
, b
, c
,... are mapped to glyphs that are defined by a person. 诸如
a
, b
, c
,...之类的字符映射到人定义的字形。 For instance a
corresponds with the Apple logo, b
corresponds with a glyph shaped as a banana, c
looks like a coconut. 例如,
a
对应于Apple徽标, b
对应于形状为香蕉的字形, c
看起来像椰子。
a
, b
, c
,... See also my answer to the question Why can't I extract text added using a Type3 font correctly? a
, b
, c
等字符。 ..另请参阅我对以下问题的回答: 为什么我不能正确提取使用Type3字体添加的文本? Sometimes, people will match characters and glyphs, the way I did when I created a Type3 font for the iText logo: read Creating the iText logo witha Type3 font . 有时,人们会匹配字符和字形,就像我为iText徽标创建Type3字体时所做的那样:请阅读使用Type3字体创建iText徽标 。 However you shouldn't count on that.
但是,您不应指望这一点。 Any character can be mapped to any glyph.
任何字符都可以映射到任何字形。
Now that you know this, you should understand that you're trying to achieve something that is impossible. 现在,您已经知道了这一点,您应该了解,您正在尝试实现一些不可能的事情。 Suppose that you have a PDF with a Type3 font where the
a
character corresponds with an apple, the b
character with a banana and the c
character with a coconut, it won't be possible to automatically replace such a user-defined font with a custom encoding with another "normal" font that doesn't know how to draw apples, bananas and coconuts, and that uses a completely different encoding. 假设您有一个带有Type3字体的PDF,其中
a
字符对应一个苹果, b
字符对应一个香蕉, c
字符对应一个椰子,那么将无法自动用a替换这种用户定义的字体。使用另一种“普通”字体进行自定义编码 ,该字体不知道如何绘制苹果,香蕉和椰子,并且使用完全不同的编码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.