ReptarX / pyfpdf

Automatically exported from code.google.com/p/pyfpdf
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Printing Trademark (TM) symbol in PDF #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. TM = U'\u2122', text = "ABCXYZ"
2. pdf.cell(0, 10, text+TM, 0, 1, 'C'
3. pdf.output(outputFileName, 'F')

What is the expected output? What do you see instead?
Expected to see TM symbol on printed PDF. Saw: 
"UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2122' in 
position 32: ordinal not in range"

What version of the product are you using? On what operating system?
Python 2.7, Windows

Please provide any additional information below.
I need to print the trademark symbol in a PDF. Either the unicode character or 
a way to superscript "TM" would work.

Original issue reported on code.google.com by venmathi...@gmail.com on 17 Apr 2014 at 4:06

GoogleCodeExporter commented 9 years ago
**FPDF Version - 1.7

Original comment by venmathi...@gmail.com on 17 Apr 2014 at 4:09

GoogleCodeExporter commented 9 years ago
You would need to use an unicode (utf8) font, as by default standard fonts are 
latin 1, so that character doesn't exist in that encoding (as the python error 
says).
Please see:

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

Let me know if that solves your issue

Original comment by reingart@gmail.com on 17 Apr 2014 at 4:15

GoogleCodeExporter commented 9 years ago
Oops, sorry about the noob question. Thanks! Switched the font to DejaVu and it 
worked.

Original comment by venmathi...@gmail.com on 18 Apr 2014 at 3:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi again. Not sure if this is the right place to post this question, but is 
there a particular python to exe converter recommended for use with PyFPDF? I 
tried pyinstaller, but the EXE file doesn't generate the PDF file when I run it 
on a different computer.

Original comment by venmathi...@gmail.com on 21 Apr 2014 at 11:38

GoogleCodeExporter commented 9 years ago
Please, xould you fill a news issue?
Also attach the sample code, error message, and some context info like how are 
you building the installer.
I could help you with some tunning if the problem is related to the paths 
(knowing the stack trace and other relevant info.

Original comment by reingart@gmail.com on 22 Apr 2014 at 5:46