Reputation: 1617
Is there any way to print pdf with PDFKit and custom font?
In css I have:
@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");
Above code works fine when render as html but printing to pdf with PDFKit use standard font. Any clues?
Upvotes: 4
Views: 2249
Reputation: 747
I guess your pdfkit just can't find where your font files are. I had the same issue with images in pdf. Try to substitute all your urls for font files with local file paths:
url("#{Rails.root}/path_to_font/chaparralpro-regular-webfont.eot");
Upvotes: 1