Print.js 怎么使用@font-face导入的字体?

 <div id="printMe">
      <h1>这是一段话</h1>
 </div>
@font-face {
  font-family: 'FZBS';
  src: url('FZBS.ttf');
  font-weight: normal;
  font-style: normal;
}
h1 {
  font-family: 'FZBS';
  color: red;
}
printJS({
        printable: 'printMe',
        type: 'html',
        style: `
              @font-face {
                font-family: 'FZBS';
                src: url('FZBS.ttf');
                font-weight: normal;
                font-style: normal;
              }
              h1 {
                font-family: 'FZBS';
                color: red;
              }
              `
      })

这是我目前的写法,打印时字体不生效

阅读 2.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题