我正在使用 Grails 渲染插件来生成 PDF。
我想在我的 PDF 中包含 CSS 以便更好地呈现它。我在上找到了一个例子渲染插件网站 http://gpc.github.io/grails-rendering/docs/manual/guide/single.html
我将下面的 CSS 放在印刷媒体中,以便它适用于 PDF,但这对我不起作用。我也不知道如何将字体从 Arial 更改为其他字体。谁可以给我解释一下这个?
该插件使用 Arial 字体和 CSS:
@font-face {
src: url(path/to/arial.ttf);
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: cp1250;
}
body {
font-family: "Arial Unicode MS", Arial, sans-serif;
}
您需要 arialuni.ttf 而不仅仅是 arial.ttf 在此处下载:http://www.findthatfonts.com/search-2683324-hTTF/fonts-download-search-engine-ARIALUNI.ttf.htm http://www.findthatfonts.com/search-2683324-hTTF/fonts-download-search-engine-ARIALUNI.ttf.htm
Then
你必须给你的@font-face一个字体系列名称,如下所示:
@font-face {
font-family: "Font-Name";
src: url(path/to/font.ttf); // you have to add your font.ttf file to the server in a folder like assets/css/fonts or something.
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: cp1250;
}
body {
font-family: "Font-Name", Arial, sans-serif; // you called your font Font-Name in the @font-face so now you can use it as Font-Name everywhere else in you css.
}
否则,您的 arialuni.ttf 没有名称,因此您无法在 css 的其他 div 中使用它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)