【问题标题】:PDFKIT custom fontsPDFKIT 自定义字体
【发布时间】:2012-06-22 10:26:18
【问题描述】:

有没有办法用 PDFKit 和自定义字体打印 pdf?

在 css 中我有:

 @font-face {
font-family: 'ChaparralProRegular';
src: url("path_to_font/chaparralpro-regular-webfont.eot");
src: url("path_to_font/chaparralpro-regular-webfont.eot?#iefix") format("embedded-opentype"),
url("path_to_font/chaparralpro-regular-webfont.woff") format("woff"),
url("path_to_font/chaparralpro-regular-webfont.ttf")  format("truetype"),
url("path_to_font/chaparralpro-regular-webfont.svg#ChaparralProRegular") format("svg");

以上代码在呈现为 html 时工作正常,但使用 PDFKit 打印到 pdf 时使用标准字体。 有什么线索吗?

【问题讨论】:

  • JFI 你是否提供了带有样式表的媒体屏幕,还有在wkthmltopdf 中附加样式表的选项以附加样式表我猜pdfkit 也支持它,是的,它确实kit.stylesheets << '/path_to_your_stylesheet

标签: ruby-on-rails pdfkit


【解决方案1】:

我猜你的 pdfkit 只是找不到你的字体文件在哪里。我对pdf中的图像有同样的问题。 尝试用本地文件路径替换字体文件的所有 url:

url("#{Rails.root}/path_to_font/chaparralpro-regular-webfont.eot");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-21
    • 2018-04-16
    • 2017-10-13
    • 2018-04-30
    相关资源
    最近更新 更多