获取 wkhtmltopdf 来识别用户字体文件夹

发布于 2024-11-27 08:18:36 字数 271 浏览 3 评论 0原文

我想我的问题已经在这里指出了...我已将一些非标准字体安装到我的 ~/.fonts 目录中并运行“mkfontdir”和“mkfontscale”。当我用“fc-list”列出字体时,这些字体就会显示出来。问题仍然是 wkhtmltopdf 无法识别它们。其他系统字体(如“Courier 10 Pitch”)可以被识别......只是不是我的用户目录中的字体。那么有没有办法让 wkhtmltopdf (或者 webkit)识别我的文件夹中的字体?我需要通过 ssh 做些什么吗?或者我可以在 ruby​​ 中设置一个选项吗?

I think I have my problem pinpointed here...I've installed some non-standard fonts into my ~/.fonts directory and run 'mkfontdir' and 'mkfontscale'. The fonts show up when I list them with 'fc-list'. The problem remains that wkhtmltopdf doesn't recognize them. Other system fonts like 'Courier 10 Pitch' are recognized...just not what's in my user directory. So is there a way to get wkhtmltopdf (or for that matter, webkit) to recognize the fonts in my folder? Is there something I have to do over ssh or is there an option I can set in ruby?

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

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

发布评论

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

评论(1

小梨窩很甜 2024-12-04 08:18:36

问题还存在吗?我刚刚尝试使用虚拟 Ubuntu 服务器,并且字体工作没有任何问题,尽管我从存储库获得的版本是 0.9.9,这是相当旧的。我的过程:

  1. 安装了 xserver、fluxbox、mupdf(查看器)、chromium 和 wkhtmltopdf
  2. 得到了一个很棒的字体(PonyRides)
  3. Ran mkfontdir、mkfontscale 和 fc-list(字体显示在列表中)
  4. 制作了一个 test.html,其中有一个段落使用了自定义字体
  5. wkhtmltopd test.html test.pdf

我在本地检查了 pdf,然后在另一台计算机上检查,自定义字体甚至在那里工作,即使我没有已经安装了字体。 http://temp-share.com/show/dPf3m39HW <- 生成的 PDF(我希望该链接不是太临时)。

Does the problem still exist? I just tried with a virtual Ubuntu server and got fonts working without any problems even though the version I got from the repositories is 0.9.9 which is pretty old. My process:

  1. Installed xserver, fluxbox, mupdf (viewer), chromium and wkhtmltopdf
  2. Got an awesome font (PonyRides)
  3. Ran mkfontdir, mkfontscale and fc-list (font showed up on list)
  4. Made a test.html with a single paragraph that used the custom font
  5. wkhtmltopd test.html test.pdf

I checked the pdf locally and then on another computer and the custom font even worked there even though I didn't have the font installed. http://temp-share.com/show/dPf3m39HW <- generated PDF (I hope the link is not too temporary).

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