Font change for print format in pdf

I need to change the font in print format.
It is visible when i press print button but on viewing pdf, font is getting changed to default.
Is it possible to change fonts in pdf ??


You should create another print format with the required font. That Print Format will render values in that font in HTML as well as in PDF format.

@umair i did, it is reflecting in print but not in pdf
should i add something in css so that it will be visible in pdf also.
I have added the fonts in server also

hi all,

I am picking up on this as I believe this is an issue in the pdf implementation. In the use case as above, a user wants to define custom fonts in a print (assuming for now a custom print format). He/she will add the following css item (example):

.print-format {
  font-family: "Times New Roman", Times, serif;

This is correctly reflected in the preview, but as soon as the pdf function ( is called, any custom font is overwritten and the default appears. This cannot even be corrected with !important. Also, independent of the “Print Settings”, the font in the pdf after wkhtmltopdf seems always to be sans-serif.

Font directives from the css should be applied. Shall I open an issue on github?

Edit: seems like this is a deeper issue with wkhtmltopdf…


I installed fonts by using this command, this solved the fonts issue in pdf

 sudo apt-get install ttf-mscorefonts-installer

Hi @raghu9,

thanks for the hint, but I get a checksum failed warning when trying to install this package in Debian 9 stretch. Seems to be repeatable…

hey @lasalesi This maybe an old thread . Faces similiar issue with the font sixe on description. I was getting about 2 items per page due to the size. Client needed min 5 items per page to reduce print size. Heres what I had to do to th items description HTML.

    <summary><span style="font-size: 8px; font-family: Helvetica;">
    {{ item.description }}    

The CSS does not work when rendering to PDF however if the code is written per line then it behaves properly. It is more work but end result is as per expectation.

For those who are running RHEL / CentOS / Almalinux / RockyLinux, getting the PDF right also needs ms truetype fonts.
You can install them with dnf localinstall