translatePDF
translatePDF copied to clipboard
error after decoded pdf
python2 tpdfrw.py cccht2.pdf Font not translated: /TT1 /VMGCWN+MicrosoftYaHeiLight Font not translated: /TT0 /GBCYZR+SimSun handle ( ) handle ( ) handle ( ) handle ( ) Font translated: /C0_0 /UDSRIP+MFLangSong_Noncommercial-Regular font {'/Encoding': '/Identity-H', '/Type': '/Font', '/BaseFont': '/UDSRIP+MFLangSong_Noncommercial-Regular', '/Subtype': '/Type0', '/DescendantFonts': (53332, 0), '/ToUnicode': (53333, 0)} --> [(58825, 0)] --> None (<type 'exceptions.AttributeError'>, AttributeError("'NoneType' object has no attribute 'has_key'",), <traceback object at 0x3d128c0>) readStream: The object does not have a stream? None Traceback (most recent call last): File "tpdfrw.py", line 320, in
main() File "tpdfrw.py", line 313, in main tpdf=TranslatedPdf(args.input, translator, args.default_ttf) File "tpdfrw.py", line 181, in init self._translatePage(page, translator) File "tpdfrw.py", line 267, in _translatePage self._updatePageFontDecodeDicts(page) File "tpdfrw.py", line 218, in _updatePageFontDecodeDicts self.decodeDicts[font_id]=getFontDecodeDict(font) File "tpdfrw.py", line 90, in getFontDecodeDict tmpttf=fontTools.ttLib.TTFont(StringIO.StringIO(ttfbuf)) File "/usr/lib64/python2.7/site-packages/fontTools/ttLib/init.py", line 182, in init self.reader = sfnt.SFNTReader(file, checkChecksums, fontNumber=fontNumber) File "/usr/lib64/python2.7/site-packages/fontTools/ttLib/sfnt.py", line 84, in init raise ttLib.TTLibError("Not a TrueType or OpenType font (not enough data)") fontTools.ttLib.TTLibError: Not a TrueType or OpenType font (not enough data)
python2 tpdfrw.py xxx.pdf
Traceback (most recent call last):
File "tpdfrw.py", line 320, in
(py27) D:\Code\pythonRequireProj\pdfContentSimToTra>python tpdfrw.py samples\Test.pdf
Traceback (most recent call last):
File "tpdfrw.py", line 320, in