如何在不嵌入的情况下使用 TCPDF 在 PDF 中使用 Arial

发布于 2024-12-14 10:53:09 字数 214 浏览 4 评论 0原文

我已成功将字体 Arial 添加到 TCPDF,但是由于嵌入了该字体,文件大小很大。我本以为 Arial 是绝大多数用户机器上的标准字体,所以有没有办法通过使用 Arial (如果可用)然后使用 Helvetica 来工作 如果没有,那么有任何 sans-serif 字体作为备份吗?

I have successfully added the font Arial to TCPDF, however the filesize is large due to it embedding the font. I would have thought Arial was a standard font on the vast majority of users machines, so is there a way of it working by using Arial if available, then Helvetica if not, then any sans-serif font as a backup?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

狼亦尘 2024-12-21 10:53:09

您可以对字体进行子集化,从而仅嵌入文档中实际使用的字形。这将节省一些空间,因为 Arial 具有用于非常大的 Unicode 字符空间的字形。

它是 setFont() 调用中的最后一个参数(滚动到页面底部)。

You can subset the font, which embeds only the glyphs that are actually used in your document. That'll save some space as Arial has glyphs for a very very large swath of the Unicode character space.

it's the last argument in the setFont() call (scroll to the bottom of the page).

不…忘初心 2024-12-21 10:53:09

我发现,如果我删除字体文件夹中除以 .php 结尾的文件之外的所有 arial 文件,文件大小会下降到 500KB 左右,就像tcpdf。我想这意味着它们现在没有嵌入,如果用户没有 arial,它们将恢复为用户计算机上的另一种无衬线字体。

I found that if I remove all arial files in the fonts folder other than the ones ending in .php, the filesize drops to around 500KB, just like the other core fonts in tcpdf. I would imagine that this means they are now not embedded and will revert to another sans-serif font on the users machine if they don't have arial.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文