PDFViewer.py ValueError: invalid literal for int() with 10

Hi,
I am trying to run pdfviewer.py example but I am getting the following error:

Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/wx/_core.py”, line 16772, in
lambda event: event.callable(*event.args, **event.kw) )
File “/usr/local/lib/python2.7/dist-packages/wx/lib/pdfviewer/viewer.py”, line 451, in DrawFile
self.page.extractOperators(), pdf_fonts)
File “/usr/local/lib/python2.7/dist-packages/wx/lib/pdfviewer/viewer.py”, line 543, in ProcessOperators
drawlist.extend(self.DrawTextString(operand[0]))
File “/usr/local/lib/python2.7/dist-packages/wx/lib/pdfviewer/viewer.py”, line 598, in DrawTextString
dlist.append(self.DrawTextItem(item, f))
File “/usr/local/lib/python2.7/dist-packages/wx/lib/pdfviewer/viewer.py”, line 610, in DrawTextItem
width = stringWidth(textitem, g.font, g.fontSize)
File “/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfmetrics.py”, line 723, in stringWidth
return getFont(fontName).stringWidth(text, fontSize, encoding=encoding)
File “/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfmetrics.py”, line 689, in getFont
return findFontAndRegister(fontName)
File “/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfmetrics.py”, line 671, in findFontAndRegister
face = getTypeFace(fontName)
File “/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfmetrics.py”, line 642, in getTypeFace
afm = bruteForceSearchForAFM(faceName)
File “/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfmetrics.py”, line 228, in bruteForceSearchForAFM
topDict, glyphDict = parseAFMFile(possible)
File “/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfmetrics.py”, line 110, in parseAFMFile
width = string.atoi(r)
File “/usr/lib/python2.7/string.py”, line 403, in atoi
return _int(s, base)
ValueError: invalid literal for int() with base 10: ‘458.33333’, while looking for faceName=‘YGNEGW+TimesNewRomanPS-BoldMT’

I am using Ubuntu 12.4 TLS, wxpython 2.9.4.0, and pyPdf 1.13. Any idea ?

Thanks.

The pdf viewer doesn’t support embedded fonts when used with pyPdf, only the 14 standard fonts that are supported by pdf itself. I will try and fix the code so this error is handled more gracefully, but if you want to be able to view pdf files without any restrictions, use the mupdf library (via Python-fitz bindings)

    https://github.com/rk700/python-fitz

    http://www.mupdf.com
···

On Monday, November 11, 2013 4:11:06 PM UTC, mohsen jadidi wrote:

Hi,
I am trying to run pdfviewer.py example but I am getting the following error:

Traceback (most recent call last):

File “/usr/lib/python2.7/string.py”, line 403, in atoi
return _int(s, base)
ValueError: invalid literal for int() with base 10: ‘458.33333’, while looking for faceName=‘YGNEGW+TimesNewRomanPS-BoldMT’

I am using Ubuntu 12.4 TLS, wxpython 2.9.4.0, and pyPdf 1.13. Any idea ?

Thanks.


Regards
David Hughes