reingart / pyfpdf

Simple PDF generation for Python (FPDF PHP port)
https://code.google.com/p/pyfpdf/
GNU Lesser General Public License v3.0
849 stars 515 forks source link

hebrew #180

Open yishairasowsky opened 3 years ago

yishairasowsky commented 3 years ago

when i tried to put in hebrew, then it failed. can i share a screen shot? this works:

from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size = 15)
pdf.cell(200, 10, 
         txt = 'abc', 
         ln = 1, align = 'C')
pdf.output("GFG.pdf")   

but when i change to txt = 'אבג' then i get an error:

---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-21-cb3542cc6029> in <module>()
      7          txt = 'אבג',
      8          ln = 1, align = 'C')
----> 9 pdf.output("GFG.pdf")

3 frames
/usr/local/lib/python3.7/dist-packages/fpdf/fpdf.py in _putpages(self)
   1168             if self.compress:
   1169                 # manage binary data as latin1 until PEP461 or similar is implemented
-> 1170                 p = self.pages[n].encode("latin1") if PY3K else self.pages[n]
   1171                 p = zlib.compress(p)
   1172             else:

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 51-53: ordinal not in range(256)
yishairasowsky commented 3 years ago

@reingart @eocasio @niphlod @yanone @leoleozhu @

Lucas-C commented 3 years ago

This project is not maintained anymore, cf. #171

Also, this question has already been answer on StackOverflow: https://stackoverflow.com/questions/57806280/unicodeencodeerror-latin-1-codec-cant-encode-when-trying-to-write-hebrew-to

yishairasowsky commented 3 years ago

thank you!

On Sat, Mar 27, 2021 at 11:32 AM Lucas Cimon @.***> wrote:

This project is not maintained anymore, cf. #171 https://github.com/reingart/pyfpdf/issues/171

Also, this question has already been answer on StackOverflow: https://stackoverflow.com/questions/57806280/unicodeencodeerror-latin-1-codec-cant-encode-when-trying-to-write-hebrew-to

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/reingart/pyfpdf/issues/180#issuecomment-808691019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJN7CN6JQ363HHRV6KRBPHLTFWJ3DANCNFSM4ZYA5TNQ .

-- Yishai Rasowsky 054.848.2245 Audio classes here https://anchor.fm/yishai-rasowsky.