为什么iText嵌入字体,即使我指定不嵌入? [英] Why is iText embedding font even if I have specified not to embed?

查看:866
本文介绍了为什么iText嵌入字体,即使我指定不嵌入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Noto字体来创建pdf并查看嵌入的字体而不是嵌入它们。我的代码

  FontFactory.register(c:/temp/fonts/NotoSansCJKsc-Regular.otf,my_nato_font); 
Font myBoldFont = FontFactory.getFont(my_nato_font,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);

在创建pdf并执行CTRL + D时,可以看到字体已经嵌入。然而,一旦我选择了

 FontFactory.register( c:/temp/fonts/NotoSansCJKsc-Regular.otf,my_nato_font); 
Font myBoldFont = FontFactory.getFont(my_nato_font);

文件大小减少,字体没有嵌入。现在我看不到我已经添加到PDF中的中文字。



我的问题


  1. 为什么NOT_EMBED选项仍然嵌入字体?

  2. 由于Noto字体是由Google开源的,并且由Adobe支持介绍源汉斯,我假定最终用户应该能够查看文档,即使不需要嵌入他们。我的理解是错误的吗?


解决方案

您正在使用Identity-H,嵌入,因为如果嵌入的参数不会被忽略,iText会创建一个违反ISO-32000-1的PDF: p>


9.7.5.2节
$ b

H和Identity-V CMaps不得与非嵌入字体一起使用。


Adob​​e拥有大量专利PDF软件。在您创建符合PDF规范的PDF文件的情况下,Adobe授予任何人免费使用这些专利的权利。 如果你想调整iText,使其不会嵌入Identity-H CMaps的字体,那么你将违反PDF规范,这也可能会导致一些专利侵权。


I am using Noto fonts to create pdf and looking embedding of a font vs not embedding them. My code

   FontFactory.register("c:/temp/fonts/NotoSansCJKsc-Regular.otf", "my_nato_font");
   Font myBoldFont = FontFactory.getFont("my_nato_font", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);

When I create the pdf and do a CTRL + D, I can see that the fonts have been embedded.

However once I go with option

   FontFactory.register("c:/temp/fonts/NotoSansCJKsc-Regular.otf", "my_nato_font");
   Font myBoldFont = FontFactory.getFont("my_nato_font");

The size of file is reduced and the fonts are not embedded. Now I cannot see the Chinese characters which I have added to the pdf.

My questions

  1. Why does NOT_EMBED option still embed the font ?
  2. Since Noto fonts are open sourced by google and supported by adobe Introducing Source Hans , I would assume that end user should be able to view the documents even with out the need to embed them. Is my understanding wrong ?

解决方案

You are using Identity-H, the font shall be embedded because if the embedded parameter wouldn't be ignored, iText would be creating a PDF that is in violation with ISO-32000-1:

Section 9.7.5.2:

The Identity-H and Identity-V CMaps shall not be used with a non-embedded font.

Adobe owns a whole lot of patents with respect to PDF software. Adobe grants the right to any one to use these patents for free on condition that you create PDF files that are compliant with the PDF specification.

If you would tweak iText so that it would not embed fonts with Identity-H CMaps, you would be in violation with the PDF specification and that could bring about some patent violations too.

这篇关于为什么iText嵌入字体,即使我指定不嵌入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆