mrafiqk/html-pdf-node

If we use header template custom font (.TTF) file not loading

Opened this issue · 2 comments

Hello @ALL,

I am trying to create header using own custom html template, but i dont know why my fonts are not loading in html thats why in pdf header that's did not change any font

please can you help me to how to do that

let sd = `
<html>
<head>
   <style>
      @font-face {
         font-family: TERAFONT-CHANDANA;
         src: url("path of the file"/CHANDANA.TTF);
      }
      
       @font-face {
         font-family: TERAFONT-AAKASH;
         src: url("path of the file"/CHANDANA.TTF);
      }
   
       @font-face {
         font-family: "B-Bharati-GopikaTwo";
         src: url('BGOT____0.TTF');
      }
      th{
         font-size:15px;
         text-align:center;
      }
   </style>
</head>
<body>
   <table style = "margin-top:-10px;">
      <tr>
         <th colspan="2" style= "font-family:TERAFONT-AAKASH">
             _! v I]lS,0GL EFUlJlW VG[ JF:TlJS ;bIFVM
         </th>
      </tr>
      <tr>
         <td style = "font-size:10px;padding-right:350px">
            Organization: ${pdf_JSON.header.org}
         </td>
         <td style = "font-size:10px;">
            Date: ${pdf_JSON.header.date}
         </td>
      </tr>
      <tr>
         <td style = "font-size:10px;padding-right:350px">
            course: ${pdf_JSON.header.course}
         </td>
         <td style = "font-size:10px;">
            Duration: ${pdf_JSON.header.duration}
         </td>
      </tr>
   <table>
</body>
</html>
`


let options = { 
   format: 'A4',
   displayHeaderFooter:true,
   headerTemplate:sd,
   margin:{
      top:90,
      bottom:90
   } 

};

default font like

font-family: "Times New Roman", Times, serif

this thing work only custom font is not working

Same issue here. Any solution? I also tried embedding the font in base64 but it doesn't work