Fonts in PDF not working

Hi all, not sure what I am doing wrong. I’ve changed the font in a pdf template to what I want but when I come to print the PDF it has not changed. All teh HTML is correct to what I want and on screen in the editor it has changed but when I come to print it has not. For the life of me I cannot figure what I am doing wrong. Many thanks for any help.

Hey there,

What Fonts did you use, by chance?

I’ve given it a go with a few different fonts, and get varied results:

On the CRM they show as:
image

Whereas in the printed PDF they show as:


(Where Impact seems to be the only incorrect one)


It might be a bug of sorts, but would be good to know, so we can narrow things down!

Hi I’ve tried all sorts of fonts - on the screen before I print the PDF it looks fine. But when I download/print the pdf the format is not the correct font.

hmm, do you get the same issue on different browsers too?

If so, it sounds like it may be a bug

I’m not sure of a solution, but it would be worth raising on the Github Repo where the issue can be tracked against the project

Any additional info you can provide on the bug would be appreciated!
(eg: Examples of Fonts used)

Tried again by creating a new pdf using the Impact font and no luck with it.

I actually pulled my hair with this a year or so back. The problem is – or was for me – a disparity between fonts shown in TinyMCE and the fonts available to mPDF backend. I don’t remember the specifics, but basically mPDF had a lot fewer fonts and just aliased other fonts to those few. The solution was to upload the font you want to use (make sure the font’s licence allows you to do so!) to mPDF’s font directories and add it to relevant files to be recognized. However if I remember right – and I might not – you couldn’t even add fonts to custom/ so there is (or at least wasn’t back then) no way to make it upgrade safe.

1 Like

Has anyone got a step by step idiots guide on how to sort this problem out. I’m on the latest version of the software, php etc

Hello

If you check how the mPDF library function is called then you would understand better.

e.g here in this file /modules/AOS_PDF_Templates/formLetterPdf.php

mPDF library’s font configuration is defined at /modules/AOS_PDF_Templates/PDF_Lib/config_fonts.php
Where you can see that the FONTS used by PDF library are different than the TinyMCE or any other that you declare. Check the fonttrans array and the one below it.

Just for reference, this is the GitHub issue:

Dear all,

For the Chinese font support in PDF template.

When I print contact, all the Chinese words shows as small rectangular. Could someone help me solve this problem in the 7.13.2 version. Also, I can not find the /modules/AOS_PDF_Templates/PDF_Lib folder, May someone know the reason?

Thanks

Regards

wendy