Reputation: 1749
I am using fpdf
python package to create a .pdf
file.
This is my code below:
import fpdf
pdf = fpdf.FPDF(format='letter') # pdf format
pdf.add_page() # create new page
pdf.set_font("Arial", size=18) # font and textsize
pdf.cell(200, 10, txt="An enhanced Interactive’ Python", ln=1, align="C")
pdf.output("test.pdf")
But it is giving me an error as:
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 74: ordinal not in range(256)
I am not sure why this is popping up when I want to save the pdf using pdf.output("test.pdf")
.
Upvotes: 1
Views: 667
Reputation: 54698
U+2019 is the fancy right single quotation mark, which you DO have in your string after the word "Interactive". I suspect you don't really want that character at all.
Upvotes: 1