Comments (5)
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.
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.
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.
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.
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)
- single quotes disappear
- Unicode problem in fpdf HOT 3
- Ln parameter of Cell does not work. Ln() default does not work. Multicell causes divide by zero fault. HOT 2
- FPDF' object has no attribute 'y' HOT 2
- Code39 does not work HOT 1
- Template.split_multicell push data before FPDF.add_page called HOT 2
- Patch for /fpdf/template.py HOT 6
- Patch for /fpdf/template.py HOT 2
- Printing Trademark (TM) symbol in PDF HOT 6
- "ouput" has default/hard-coded fonts location - throws I/O exception when different location used HOT 4
- Fail using easyinstall for MacOSX and python 3.4 HOT 4
- Integer division causes divide by zero error when units is 'in'. Errant code identified, but no patch supplied. HOT 2
- Web2py sample app has what should be view code in the controller, but is easily fixable HOT 1
- pyfpdf html to pdf mis-handles '<', '>', '&' and ' in tables. HOT 4
- Vertical align in cell
- get_string_width report wrong value for missed glyphs HOT 2
- PDF document blocked HOT 2
- PYFEPDF in VBNET HOT 1
- Could not output pdf text to browser HOT 1
- Multiple pdf?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyfpdf.