Font issue XB Riyaz.ttf

Hi InvoicePlane team,

recently when we try to generate pdf file, we always receive the message of

“mPDF Error - cannot find TTF TrueType font file”

and that the font XB Riyaz.ttf is missing

which results in no possibility of downloading a prepared invoice.

If possible, could you please look into this and advise how this can be solved?

Kindest regards

IP does not uses neither includes this font. IP comes with its own (stripped-down, customised) version of mPDF,

that includes only the DejaVuSans and DejaVuSerif fonts.

Which version of IP are you running? how did you install it? have you installed mPDF separately?

If you have customised your IP installation or PDF templates to use that font, a possible fix could be to download the XB Riyaz TTF files from the mPDF repository

and to move them into the folder “vendor/mpdf/mpdf/ttfonts/” of your IP installation.

Read this topic

for additional information on how to solve the problem with missing fonts.

Hi Miquel,
thank you very much for your help, uploading the font (partially) worked!
There is still an issue though: the error doesn’t show up any more and now the preview can be seen, however it also shows a strange sign as on the screenshot below. Normally there should be anything there instead of this sign.

Maybe to solve this is there a possibility in the program to simply choose which font should invoices be showed in?
Not sure it’s visible on the screenshot, but also the invoice number show up in a different font than the rest of the invoice. It’s not a problem, but apparently for some reason than area of the program pulls a different font.
Kindest regards and thanks a lot again!

That square with a question mark means the letter or symbol that should have been drawn in that position is missing in the original font or in the substitute fonts available. Can you provide some more information:

  • Does it happen in the html, in the pdf or in both?
  • Which symbol was displayed before installing the new font?

Even better, could you copy and paste in your reply the text with the missing symbol shown in your screen capture? Make sure to put it in a separate line and that it looks the same when pasted in your reply.

Hi Miquel,
thanks a lot for your answer.
It happens after we use the option “Download PDF”, so in the browser (where the URLs have the generate_pdf part). The downloaded pdf file looks the same as in the browser.
Before there was the initial error (“mPDF Error - cannot find TTF TrueType font file”) there was just an empty space, it would simply look as “Invoice 01” in the same font. At the moment “Invoice” and “01” display in different fonts.
Copy pasting gives this:
Invoice 01
Not sure why the question mark doesn’t copy…
Kindest regards

Mystery solved with the help of this question posted in Stack Exchange.

Short answer: you have the Unicode character “ZERO WIDTH NO-BREAK SPACE” between the space after “Invoice” and the “01”. I don’t now how you got the invoice number, but somehow you have introduced that character in your invoices numbering scheme.

Long answer: the text you pasted does contain the extra character, though it is not seen because this forum software uses Unicode internally and hence properly displays the “zero width space character”. I have copied the whole string to a plain text editor, the I have saved the file, and the octal dump of the content shows the extra character “357 273 277” after the space character (040) and before the zero character (060)

$ od -cb missing-character.txt 
0000000   I   n   v   o   i   c   e     357 273 277   0   1  \n
        111 156 166 157 151 143 145 040 357 273 277 060 061 012

and this page says that “357 273 277” is the octal representation of the Unicode character “ZERO WIDTH NO-BREAK SPACE”.

1 Like

Now, to fix the problem, you should tell us how exactly you got the “Invoice 01” text. Did you copy it from a text editor?

If you are using the “Identifier Format” field in the Invoice Group, this recipe may fix the problem:

  • edit the Invoice Group you are using for your invoices
  • delete the content of the “Identifier Format” field and then save the group but do not quit the page
  • type (do not copy&paste from another editor) in the field the text you want to display in your numbering scheme, then save the group.
  • generate a new pdf file and check if the error is gone.

It’s amazing, but retyping the invoice number did solve the problem!
Thank you very much!