1

I want to create a PDF file from python with Cyrillic letters.

My code here doesn't work:

from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.set_font('arial')
text = 'а'
pdf.cell(10,10,text,0,1)
pdf.output('out.pdf', 'F')

When doing this, I got this error:

UnicodeEncodeError: 'latin-1' codec can't encode character '\u0430' in position 50: ordinal not in range(256)

How can I create a PDF file from python with Cyrillic letters?

Jeff Learman
  • 2,914
  • 1
  • 22
  • 31
Yoyoyo
  • 11
  • 1

0 Answers0