库HTML-PDF提供字体为斜体样式

发布于 2025-01-21 07:15:32 字数 538 浏览 2 评论 0原文

我使用HTML-PDF将HTML转换为PDF。但是,当我包含我的字体AS

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap" rel="stylesheet">

并在CSS中写入时:

html {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 14px;
}

它使我的字体成为斜体。但是在html中,它是正常的字体。如何解决?我尝试了字体面,它不起作用

I use html-pdf to convert my html to pdf. But when I include my font as

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap" rel="stylesheet">

And write in css:

html {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 14px;
}

It renders my font as italic. But in HTML it is normal font. How to solve it? I tried font-face, it did not work

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文