Python Forum

Full Version: fpdf adding a new font to my report
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I have created a class to set up the headers and footers for my pdf file.

In my header function inside the class, I would like the heading 'Book Inventory' to be in a different font.

I downloaded the font 'Good Vibes' and installed this in the windows->fonts folder on my computer.

The code I have in my .py file is:

'''
self.add_font("Good Vibes Regular", "", "great-vibes.regular.ttf", uni=True)
self.set_font("Good Vibes Regular", "", 14)
'''

When I run my code, the following error displays:

'''
raise RuntimeError("TTF Font file not found: %s" % fname)
RuntimeError: TTF Font file not found: great-vibes.regular.ttf
'''

Not sure what I have done wrong.