我正在使用fpdfpython 包來創建一個.pdf檔案。
這是我下面的代碼:
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")
但這給了我一個錯誤:
UnicodeEncodeError:“latin-1”編解碼器無法在位置 74 編碼字符“\u2019”:序數不在范圍內(256)
我不知道為什么當我想使用pdf.output("test.pdf").
uj5u.com熱心網友回復:
U 2019 是花哨的右單引號,您在字串中的“Interactive”一詞之后確實有它。我懷疑你根本不想要那個角色。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/410361.html
標籤:
上一篇:GoogleDocsPDF匯出在末尾添加了額外的空白頁
下一篇:從PDF中提取準確的表格資料
