-
Notifications
You must be signed in to change notification settings - Fork 678
Description
I’m implementing a PDF personalization pipeline that uses page.insert_textbox() to add personalized text to existing PDFs. While the text insertion works, custom fonts and bold styling consistently fail, even when trying different font registration and fallback strategies.
PyMuPDF either:
-
silently ignores the requested custom font and falls back to Helvetica,
-
or raises an error if a non-built-in font name is passed.
The same issue occurs with bold text: setting the bold flag or using font names such as "helv-bold" or custom font files does not change the rendered output.
What I Expected
- The ability to specify a custom .ttf font and use it during insertion.
- Bold text (bold=True) or bold variants of built-in fonts to render correctly.
- insert_textbox() to honor the requested font metadata.
What Actually Happens
- Custom fonts are ignored or cause insert_textbox to fail.
- Bold text never renders bold, regardless of flags or font naming conventions.
- Only core fonts (helv, times, courier) work, and only in non-bold styles.
Code Sample
status = page.insert_textbox( rect, text, fontsize=fs, fontname=fontname, # custom fonts or bold variants fail align=0, color=text_color )
Do let me know if any more details are needed.