Node-html-pdf: pageHeader Custom fonts

Created on 27 Jun 2017  路  5Comments  路  Source: marcbachmann/node-html-pdf

I ran into a problem that is the #pageHeader didn't use the custom font i assigned it in the internal css
but the font does work on the body
the CSS :
`
@font-face {
font-family: Helvitica;
src: url(fonts/Helvetica.ttf);
}

pageHeader{

  font-family: Helvetica;
  vertical-align: middle;
  text-align: center;
}

`

lastly are there any function that will send some kind of alert to the user when the pdf rendering is complete

Thanks in advance

Most helpful comment

@mischa-saunders
Its a bit messy, but it works
Basically my solution was to put in a seperate internal and in-line CSS for the header

<style>
 @font-face{
  font-family:Customfont; 
  src:url(file:///C:/fonts/customfont.ttf);
 }
</style>
<div id="header" style="font-family:Customfont;">
  Header Contents
</div>

All 5 comments

I'm also stuck on this, did you figure anything out @tsp1996 ?

@mischa-saunders
Its a bit messy, but it works
Basically my solution was to put in a seperate internal and in-line CSS for the header

<style>
 @font-face{
  font-family:Customfont; 
  src:url(file:///C:/fonts/customfont.ttf);
 }
</style>
<div id="header" style="font-family:Customfont;">
  Header Contents
</div>

you can also expose the font via public endpoint, and use that:
src: url('http://localhost:9003/public/customfont.ttf');

Images can only be loaded via HTTP, now the fonts needed to be loaded locally. SMH.

Same issue here, font-family in pageHeader is not applied...
How couldi add custom font-family and custom font-size on pageHeader ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antiframes picture antiframes  路  4Comments

jimit-hothi picture jimit-hothi  路  4Comments

wobsoriano picture wobsoriano  路  3Comments

aminjoharinia picture aminjoharinia  路  4Comments

vivekiyer114 picture vivekiyer114  路  5Comments