pdfrw
pdfrw copied to clipboard
How to change the font?
I want to make a document using a TrueType font (.ttf). The font is not system, is in a separate file. How can I integrate it into the document? Changing FONT_NAME does not change the font in the resulting document. Any help would be very helpful. Thanks.
page.Resources.Font.F1.Subtype = PdfName.TrueType
page.Resources.Font.F1.BaseFont = PdfName.FONT_NAME
There's no simple way to do it in pdfrw as the setting up of fonts in PDF is a rather laborous task. However, see https://github.com/sl2c/pdfrwx/blob/master/pdffont.py for an example of how this can be done in pdfrwx.