html - 错误的属性xhtml2pdf
问题描述
我正在尝试为我的xhtml2pdf
文件指定字体。通过我得到这个错误wrong attributes for <pdf:font>
我不确定指定字体属性的正确方法?
我曾尝试寻找解决方案,但找不到任何东西。
<!DOCTYPE html>
<html>
<style>
@import url('https://fonts.googleapis.com/css2?family=Itim&display=swap');
</style>
<style>
@media print {
.pagebreak { page-break-before: always; } /* page-break-after works, as well */
}
@page {
size: a4;
margin: 1cm;
@frame footer {
-pdf-frame-content: footerContent;
bottom: 0cm;
margin-left: 9cm;
margin-right: 9cm;
height: 1cm;
}
@font-face {
font-family: 'Itim', cursive;
src: url('https://fonts.googleapis.com/css2?family=Itim&display=swap');
}
</style>
<body>
<p style="font-size:1.3rem;font-family: Itim,sans-serif;">We have generated your PDF!</p>
</body>
解决方案
根据关于自定义字体的文档 xhtml2pdf
只接受TrueType font or a Postscript font.
您正在尝试使用OTF
.
尝试将您的字体转换为TTF
或Postscript
。
推荐阅读
- excel - 上个月召回格式
- javascript - 无限循环 GoogleAppScript
- python - 为什么当代码相同时我的输出不同?
- applescript - 如何识别字符串中的 6 个连续数字?
- javascript - React Router V4,不匹配Routes中第一个父级下的任何内容
- powershell - 在 Powershell 中将两个数组输出转换为具有动态更新的表
- google-apps-script - Google Appmaker 中的 JDBC 连接 - 不想在脚本中存储密码
- php - 过滤数据后出现 JSON 错误,但页面加载正常但未过滤
- javascript - 在 jQuery 中选择下一个“选择”项
- android - 未解决的参考:活动错误