marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.55k stars 544 forks source link

Why Font converted to `Italic` style in generated PDF from HTML? #676

Open denishcrest opened 2 years ago

denishcrest commented 2 years ago

I am trying to apply "Exo 2" font in PDF, It has applied BUT converted PDF showing fonts in italic style https://www.screencast.com/t/wGQ6yEpG It must be normal like we have in HTML content https://www.screencast.com/t/bjgTQR25

Tried to apply many solutions but no luck :(

My HTML content:

<HTML>
<head>
  <meta charset="utf-8">
  <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=Exo+2:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
  <style>
  @font-face {
    font-family: 'Exo 2';
    font-display: swap;
  }
  .printapp {
    font-family: 'Exo 2', 'Din Light', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    padding: 20px;
    background-color: #FFFFFF;
    font-style: normal !important;
  }
  </style>
</head>
<body>
   <div class="printapp" style="font-style: normal">SALES ORDER</div>
</body>
</html>
aroshanzamir commented 2 years ago

In the generated pdf, all text has been converted to italic. I don't know why? I have the same problem in both versions: 3.0.0 and3.0.1

flvrm92 commented 2 years ago

I have the same problem with version 2.2.0