如何将 PDF 中的 Type 3 字体转换为 Type 1 字体
我有一个嵌入了 Type 3 字体的 PDF。如何将此 Type 3 字体转换为 Type 1 字体?
I have a PDF with Type 3 font embedded. How can I convert this Type 3 font to Type 1 font?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
其他答案建议从源文件重新生成以输出 Type 1 而不是 Type 3 字体。如果可行,这可能是最好的解决方案,但在某些情况下它可能是不可能的(例如,如果源文件或生成程序因任何原因不可用)。请允许我提供另一种方法..
如何“转换掉”Type 3 字体
我能够通过在 Adobe Acrobat Pro 中打开文件来“转换掉”PDF 图中的 Type 3 字体,然后将文件打印为 Adobe PDF(Adobe Distiller 提供的虚拟打印机,Professional 套件的一部分)。我使用的是 Adobe Pro suite 版本 11(ca 2012),但较新的版本可能也可以做到同样的事情。此操作听起来很循环,但它实际上的作用是让您有机会强制将字体渲染到新的 PDF 中。
我的版本中的默认输出设置足以生成在视觉上与源 PDF 没有区别的 PDF,但是其中所有 Type 3 字体都直接呈现为矢量图形(即输出 PDF 不包含任何字体)任何类型的使用)。 Acrobat 打印对话框(至少在我的 Windows 版本中)还具有“属性”和“高级”按钮,可以在其中对输出进行各种高度详细的调整。其中包括要嵌入的 Type 1 字体列表(以及部分嵌入的设置)、输出兼容性(我使用 Acrobat 6 / PDF 1.5)、可选图像下采样等。
请注意,此过程可能会产生明显更大的 PDF输出文件。就我而言,使用 Type 3 字体的违规文本只是四分之一页图上的几十个标签,并且 PDF 文件大小在此转换期间增长了约 2 倍;然而绝对大小仍低于 50kB,因此扩展对于我的目的来说并不重要。对于较大的文档或包含更多使用 Type 3 字体的文本的文档,扩展可能会更明显,因此 YMMV。
Other answers suggest re-generating from source files to output Type 1 instead of Type 3 fonts. This is probably the best solution when feasible, but there are situations where it may be impossible (eg. if the source files or generation program are unavailable for any reason). Allow me to offer an alternate approach..
How to "convert away" Type 3 fonts
I was able to "convert away" the Type 3 fonts in a PDF figure by opening the file in Adobe Acrobat Pro, and then printing the file to Adobe PDF (a virtual printer provided by Adobe Distiller, part of the Professional suite). I'm using the Adobe Pro suite version 11 (ca 2012), but newer versions presumably can do the same. This action sounds circular, but what it actually does is gives you the opportunity to force rendering of fonts into a new PDF.
The default output settings in my version were sufficient to generate a PDF that was visually indistinguishable from the source PDF, but where all the Type 3 fonts were rendered directly as vector graphics (ie the output PDF contains NO font usage of any kind). The Acrobat print dialog (at least in my Windows version) also has both "Properties" and "Advanced" buttons where one can make all sorts of highly detailed adjustments to the output. These include things like the list of Type 1 fonts to embed (and the settings for partial embedding), output compatibility (I used Acrobat 6 / PDF 1.5), optional image downsampling, etc.
Note this procedure will probably result in a significantly larger PDF output file. In my case the offending text using Type 3 fonts was just a few dozen labels on a quarter-page figure, and the PDF file size grew by about 2x during this conversion; however the absolute size remained under 50kB, so the expansion did not matter for my purposes. For a larger document or one with more text using Type 3 fonts, the expansion might be more pronounced, so YMMV.
使用以下配置重现 matplotlib 绘图:
这将输出 Truefont 而不是字体类型 3。Matplotlib 支持三种字体类型。检查此链接以获取更多信息 https://matplotlib.org/stable/users/explain/字体.html。
特别感谢 Jamie 的博客 http://phyletica.org/matplotlib-fonts/ 为我们节省了很多时间。
Reproduce the matplotlib plots using the following configuration :
This outputs a Truefont instead of font type 3. Matplotlib supports three font types. check this link for more informations https://matplotlib.org/stable/users/explain/fonts.html.
Special thanks to Jamie's blog http://phyletica.org/matplotlib-fonts/ for saving us a lot of time.
自从有人问这个问题以来已经很多年了,但我正在为遇到这个问题的其他人(比如我)发帖。最好的解决方案是重新生成 PDF,并设置避免使用 3 类字体。例如,如果您使用 matplotlib 制作图形,则可以按照此处的说明进行操作:http://phyletica. org/matplotlib-fonts/
如果无法重新生成 PDF 或者需要太多时间,我还发现使用
convert
(在imagemagick
) 可以提供帮助。正如其他人所说,您可能会丢失信息,但这在大多数情况下都有效:convert example.pdf example.pdf
It's been many years since this was asked, but I'm posting for anyone else that ran into this problem (like me). The best solution is to regenerate the PDF with settings to avoid type 3 fonts. For example, if you make your figures with matplotlib, then you can follow the instructions here: http://phyletica.org/matplotlib-fonts/
If it is not possible to regenerate the PDF or would require too much time, I also found that the using
convert
(found inimagemagick
) can help. As others have stated, you may lose information, but this will work in most cases:convert example.pdf example.pdf
你可能做不到; Type 3 字体可以包含任何 PostScript; Type 1 字体只能包含有限的子集。
You may not be able to; Type 3 fonts can contain any PostScript; Type 1 fonts can only contain a restricted subset.