ruby-on-rails – PDFKIT自定义字体
发布时间:2020-12-17 02:02:11 所属栏目:百科 来源:网络整理
导读:有没有办法用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("embedde
有没有办法用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时使用标准字体. 解决方法
我想你的pdfkit无法找到你的字体文件.我在pdf中的图像也有同样的问题.
尝试将所有网址替换为具有本地文件路径的字体文件: url("#{Rails.root}/path_to_font/chaparralpro-regular-webfont.eot"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |