1

我使用 pdf-creator-node 包从 HTML 生成 PDF。但是,当它显示时,我的文本总是显示为斜体,即使我没有将它设置为font-style:italic。我尝试设置font-style:normal !important; 到我的正文和 HTML,但它仍然没有工作。有谁知道解决这个问题?谢谢楼主,非常感谢。

编辑:

这是我的CSS

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <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=Playfair+Display:wght@400;500&family=Sacramento&display=swap" rel="stylesheet">
    <style>
        body,
        html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: 'Playfair Display', serif;
            font-style: normal !important;
        }

        body {
            color: black;
            display: table;
            font-size: 24px;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0 auto;
        }

        .container {
            width: 900px;
            display: table-cell;
            vertical-align: middle;
            background-image: linear-gradient(45deg, #f4f4ff, #eee);
            padding: 3rem;
            position: relative;
        }

        .container img.bg-sertifikat {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            width: 100%;
        }

        .container .front{
            position: relative;
            z-index: 1;
        }

        .logo {
            color: #5A8DEE;
            margin-bottom: 3rem;
        }

        .marquee {
            color: #000;
            font-size: 48px;
            margin: 20px;
            font-weight: bold;
        }

        .assignment {
            margin: 20px;
        }

        .person {
            border-bottom: 1px solid #000000;
            font-size: 3rem;
            padding-bottom: .5rem;
            font-family: 'Sacramento', cursive;
            font-weight: normal;
        }

        .class-name {
            margin-top: 2rem;
            font-weight: bold;
            font-size: 1rem;
            font-weight: 400;
        }

        .info {
            margin-top: 3rem;
            font-family: 'Playfair Display', serif;
            padding: 1rem 5rem;
        }
        .info .date-wrapper{
            float: left;
            margin-top: 1rem;
        }
        .info .signature-wrapper{
            float: right;
        }
        .info .date-wrapper,
        .info .signature-wrapper {
            display: flex;
            flex-direction: column;
            font-size: 1rem;
        }

        .info .date-wrapper div:nth-child(1),
        .info .signature-wrapper img {
            border-bottom: 1px solid #000;
            padding-bottom: .5rem;
        }

        .info .date-wrapper div {
            margin: .2rem 0;
        }

        .info .signature-wrapper div {
            margin: .2rem 0;
        }
    </style>
</head>
4

0 回答 0