backport changes for upstream: #145, #95, #111, #117, #129, #132.

pull/33/head
Friedrich Lindenberg 2016-09-23 14:31:31 +02:00
parent 19155d35c6
commit 1820f96481
5 changed files with 14 additions and 8 deletions

View File

@ -7,7 +7,7 @@ Unicode characters instead of using decimal/hex character code.
The following data was taken by The following data was taken by
$ wget http://www.adobe.com/devnet/opentype/archives/glyphlist.txt $ wget https://partners.adobe.com/public/developer/en/opentype/glyphlist.txt
$ python tools/conv_glyphlist.py glyphlist.txt > glyphlist.py $ python tools/conv_glyphlist.py glyphlist.txt > glyphlist.py
""" """

View File

@ -162,6 +162,7 @@ ENCODING = [
('mu', None, 181, 181, 181), ('mu', None, 181, 181, 181),
('multiply', None, None, 215, 215), ('multiply', None, None, 215, 215),
('n', 110, 110, 110, 110), ('n', 110, 110, 110, 110),
('nbspace', None, 202, 160, None),
('nine', 57, 57, 57, 57), ('nine', 57, 57, 57, 57),
('ntilde', None, 150, 241, 241), ('ntilde', None, 150, 241, 241),
('numbersign', 35, 35, 35, 35), ('numbersign', 35, 35, 35, 35),

View File

@ -229,7 +229,7 @@ class PDFStream(PDFObject):
if not isinstance(filters, list): if not isinstance(filters, list):
filters = [filters] filters = [filters]
if not isinstance(params, list): if not isinstance(params, list):
params = [params] params = [params] * len(filters)
return zip(filters, params) return zip(filters, params)
def decode(self): def decode(self):

View File

@ -46,8 +46,9 @@ def compatible_encode_method(bytesorstring, encoding='utf-8', erraction='ignore'
def apply_png_predictor(pred, colors, columns, bitspercomponent, data): def apply_png_predictor(pred, colors, columns, bitspercomponent, data):
if bitspercomponent != 8: if bitspercomponent != 8:
# unsupported # unsupported
raise ValueError(bitspercomponent) raise ValueError("Unsupported `bitspercomponent': %d" %
nbytes = colors*columns*bitspercomponent//8 bitspercomponent)
nbytes = colors * columns * bitspercomponent // 8
i = 0 i = 0
buf = b'' buf = b''
line0 = b'\x00' * columns line0 = b'\x00' * columns
@ -86,7 +87,7 @@ def apply_png_predictor(pred, colors, columns, bitspercomponent, data):
line2 += six.int2byte(c) line2 += six.int2byte(c)
else: else:
# unsupported # unsupported
raise ValueError(ft) raise ValueError("Unsupported predictor value: %d" % ft)
buf += line2 buf += line2
line0 = line2 line0 = line2
return buf return buf

View File

@ -4,15 +4,19 @@ from setuptools import setup
from pdfminer import __version__ from pdfminer import __version__
import sys import sys
requires = ['six', 'pycrypto']
if sys.version_info >= (3, 0):
requires.append('chardet')
setup( setup(
name='pdfminer.six', name='pdfminer.six',
version=__version__, version=__version__,
packages=['pdfminer',], packages=['pdfminer'],
package_data={'pdfminer': ['cmap/*.pickle.gz']}, package_data={'pdfminer': ['cmap/*.pickle.gz']},
install_requires=['six', 'chardet'] if sys.version_info >= (3, 0) else ['six'], install_requires=requires,
description='PDF parser and analyzer', description='PDF parser and analyzer',
long_description='''fork of PDFMiner using six for Python 2+3 compatibility long_description='''fork of PDFMiner using six for Python 2+3 compatibility
PDFMiner is a tool for extracting information from PDF documents. PDFMiner is a tool for extracting information from PDF documents.
Unlike other PDF-related tools, it focuses entirely on getting Unlike other PDF-related tools, it focuses entirely on getting
and analyzing text data. PDFMiner allows to obtain and analyzing text data. PDFMiner allows to obtain