0

How can i bold a inline string while writing to the document.

I tried the especial characters \033 but it seems that them just works on console prints not pdf outputs because them are explicitly printed in the pdf as \033... is there any other way to format strings in bold?

EDIT:

what i mean is, i need to print non-ASCII characters to a file how can i accomplish it

TTT2
  • 549
  • 2
  • 13

1 Answers1

0

The Fonts used must include an emboldened style

See the example for emboldening Arial and Times at

https://pyfpdf.readthedocs.io/en/latest/reference/set_font/index.html#example

# Times regular 12
pdf.set_font('Times')
# Arial bold 14
pdf.set_font('Arial', 'B', 14)
# Removes bold
pdf.set_font('')
# Times bold, italic and underlined 14
pdf.set_font('Times', 'BIU')

see also https://pyfpdf.readthedocs.io/en/latest/reference/add_font/index.html and https://pyfpdf.readthedocs.io/en/latest/reference/set_font/index.html

K J
  • 8,045
  • 3
  • 14
  • 36