使用 iText 从 Java 生成 RTF 时,条码字体未在 MS Word 中动态加载
我正在使用 iText API 使用 Java 生成 RTF。 RTF 文件生成得很好,但有一个要求是添加条形码。我所做的是:
FontFactory.register("c:\\windows\\fonts\\FREE3OF9.ttf", "Free 3 of 9 Extended");
return FontFactory.getFont("Free 3 of 9 Extended",20, Font.NORMAL, Color.BLACK);
我尝试加载其他字体;这工作正常,但当我使用条形码字体(FREE3OF9.ttf)时它不起作用。
RTF 文件已生成,但当我打开它时,MS Word 中的“字体名称”看起来像“New”而不是“Free 3 of 9 Extended”。当我选择单词并选择字体名称时,条形码显示正常。
我认为 Free 3 of 9 Extended Font 有问题。
I am using iText API to generate RTF using Java. The RTF file is generated fine but one requirement is adding a barcode. What i did is:
FontFactory.register("c:\\windows\\fonts\\FREE3OF9.ttf", "Free 3 of 9 Extended");
return FontFactory.getFont("Free 3 of 9 Extended",20, Font.NORMAL, Color.BLACK);
I tried loading other fonts; that was working fine, but it doesn't work when I use the barcode font (FREE3OF9.ttf).
The RTF file is generated but the the "Font name" looks like "New" instead of "Free 3 of 9 Extended" in MS Word when I open it. When I select the words and choose the font name, the barcode appears fine.
I think there is a problem with Free 3 of 9 Extended Font.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
奇怪的。我确实没有答案,但我当然可以提供一些建议。
getFont(...)
的返回值。问题完全有可能出在注册上,而您只是恢复了默认字体。我不明白为什么它会被称为“新”,但绝对值得检查。源链接是 iText v2.1.7,这是支持 RTF 的最后一个版本。在此之前的某个时间,从事该工作的人就消失在网络中,因此我们停止了对 5.0 的支持(以及许可更改、包重命名等)。
Odd. I don't really have The Answer, but I can certainly offer some advice.
getFont(...)
. It's entirely possible that the problem is in registration, and you're just getting back a default font. I don't see why it'd be called "New", but definitely worth checking.The source link is to iText v2.1.7, the last version that supported RTF. The guy who worked on it vanished into the web some time prior to that, so we stopped supporting it with 5.0 (along with the licensing change, package rename, and so forth).