**My code**
@font-face {
font-family: 'certificateitalic';
src: url('/webfontkit-20140113-085051/certificateitalic-webfont.eot');
src: url('/webfontkit-20140113-085051/certificateitalic-webfont.eot?#iefix') format('embedded-opentype'),
     url('/webfontkit-20140113-085051/certificateitalic-webfont.woff') format('woff'),
     url('/webfontkit-20140113-085051/certificateitalic-webfont.ttf') format('truetype'),
     url('/webfontkit-20140113-085051/certificateitalic-webfont.svg#certificateitalic') format('svg');
font-weight: normal;
font-style: normal;

}

this is the code which is used in generatecertificate.html.erb

有帮助吗?

解决方案

Maybe its not just the fonts, check that when you create the pdf, you are receiving all the assets you need.

Las time i checked i had to use a helper provided by wkhtmltopdf called wkhtmltopdf_stylesheet_link_tag instead of the classic stylesheet_link_tag that you should have in your view/partial/layout.

EDIT: Actually, im using wicked_pdf gem (https://github.com/mileszs/wicked_pdf), and there you have helpers like wicked_pdf_stylesset_link_tag, and solve most of the configuration of wkhtmltopdf config.

If you follow the configuration as explained there, and your font face is working correctly on the webpage, it shouldn't have any troubles in pdf generation.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top