Giter Club home page Giter Club logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
You should check your file is saved in UTF-8 (some editors doesn't handle 
encoding correctly)

año seems not to be in latin-1

Can you attach the file?

I should recommend you to use utf-8 directly, changing:

# -*- coding: utf-8 -*-

and then

pdf.cell(ln=0, h=10.0, align='C', w=75.0, txt=u'año', border=1)

(note the u in front of the string)

Latin-1 (ISO 8859-1) should not be a problem, but you can check specific 
unicode support here:

http://code.google.com/p/pyfpdf/wiki/Unicode

Original comment by [email protected] on 30 Sep 2012 at 4:12

from pyfpdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Thanks for the response. Here is the error I am seeing now:

~/pyfpdf/fpdf.py:393: UnicodeWarning: Unicode equal comparison failed to 
convert both arguments to Unicode - interpreting them as being unequal
  w += cw.get(s[i],0)
Traceback (most recent call last):
  File "issue.py", line 20, in <module>
    pdf.output('SpanishWord.pdf', 'F')
  File "~/pyfpdf/fpdf.py", line 871, in output
    self.close()
  File "~/pyfpdf/fpdf.py", line 286, in close
    self._enddoc()
  File "~/pyfpdf/fpdf.py", line 1188, in _enddoc
    self._putpages()
  File "~/pyfpdf/fpdf.py", line 964, in _putpages
    p = zlib.compress(self.pages[n])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 
85: ordinal not in range(128)


I am using vim which handles file encoding well, however I may not be handling 
the encoding correctly.

Please find the file attached.

Original comment by [email protected] on 1 Oct 2012 at 4:59

Attachments:

from pyfpdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Sorry, I cannot reproduce the bug.

I tested your code and it does work (attached is the sample pdf)

Are you using the latest version 1.7.1?

Original comment by [email protected] on 4 Oct 2012 at 4:45

Attachments:

from pyfpdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
I am using the 1.54b version that is in the pyfpdf zip. Running on a mac, so 
didn't pull down the win msi versions. Maybe the source version 1.7.1 will fix 
this.

Is the 1.54b zip not been updated or is the pyfpdf package different than the 
fpdf package?

Original comment by [email protected] on 4 Oct 2012 at 9:42

from pyfpdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Please usa at least 1.7 version

http://pyfpdf.googlecode.com/files/fpdf-1.7.zip

pyfpdf is the old package name, now you just have to import fpdf
(previous name should work, but depends on how it is intalled)

See unicode.py tutorial for a full example:

http://code.google.com/p/pyfpdf/source/browse/tutorial/unicode.py

(if you use non-latin1 chars, you will need to grab the ttf font pack)

Original comment by [email protected] on 4 Oct 2012 at 11:32

from pyfpdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.