westy92/html-pdf-chrome

RTL font not working in headerTemplate

baravak opened this issue · 2 comments

printOptions: {
      displayHeaderFooter: true,
      headerTemplate: `
        <div class="text center" style="font-family:Dana">
          سلام <span class="pageNumber" style="font-family:Iransans; color:red; direction:ltr"></span> / <span class="totalPages" style="font-family:tahoma"></span>
        </div>
      `,
      footerTemplate: '<div class="text center" style="color:green">Custom <i>footer</i>!</div>',
    },

pageNumber not showed

It seems to be working fine for me:
image

Source:

const html = `
  <html>
    <head>
      <title>TITLE</title>
    </head>
    <body>
      <div style="page-break-after:always">P1</div>
      <div style="page-break-after:always">P2</div>
      <div>P3</div>
    </body>
  </html>
`;
const result = await HtmlPdf.create(html, {
  port,
  printOptions: {
    displayHeaderFooter: true,
    headerTemplate: `
      <div class="text center" style="font-family:Dana">
        سلام <span class="pageNumber" style="font-family:Iransans; color:red; direction:ltr"></span> / <span class="totalPages" style="font-family:tahoma"></span>
      </div>
    `,
    footerTemplate: '<div class="text center" style="color:green">Custom <i>footer</i>!</div>',
  },
});
result.toFile('test.pdf');

Resulting file: test.pdf

Using: Chrome 89 on macOS 11.2.3

Closing due to no customer response. If you continue to see this issue, please comment here with some sample code to reproduce it! Thank you.