2012-06-22 43 views
4

有沒有什麼方法可以打印PDFKit和自定義字體?PDFKIT自定義字體

在CSS中我有:當如HTML,但印刷渲染PDFKit到PDF使用標準字體

@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"); 

上面的代碼工作正常。 任何線索?

+0

JFI做你所提供的媒體屏幕,你的樣式,也有選項附加樣式表'wkthmltopdf'附加樣式表我想pdfkit太支持它是,它'kit.stylesheets <<'/ path_to_your_stylesheet' – Viren

回答

1

我想你的pdfkit只是找不到你的字體文件在哪裏。我在pdf中遇到了與圖像相同的問題。 嘗試替換字體文件的所有URL與本地文件路徑:

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

不,它不適用於字體 – jbmyid

+0

不適用於字體.. – shajin