Merge pull request #33 from pudo/backports
Backport changes in pdfminer since this summerpull/37/head
commit
bc78fd2bea
|
@ -1 +0,0 @@
|
|||
*.py text eol=lf
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2004-2016 Yusuke Shinyama <yusuke at shinyama dot jp>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,4 +1,5 @@
|
|||
include Makefile
|
||||
include LICENSE
|
||||
include *.md
|
||||
include *.py
|
||||
graft docs
|
||||
|
|
|
@ -7,7 +7,7 @@ Unicode characters instead of using decimal/hex character code.
|
|||
|
||||
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
|
||||
|
||||
"""
|
||||
|
|
|
@ -162,6 +162,7 @@ ENCODING = [
|
|||
('mu', None, 181, 181, 181),
|
||||
('multiply', None, None, 215, 215),
|
||||
('n', 110, 110, 110, 110),
|
||||
('nbspace', None, 202, 160, None),
|
||||
('nine', 57, 57, 57, 57),
|
||||
('ntilde', None, 150, 241, 241),
|
||||
('numbersign', 35, 35, 35, 35),
|
||||
|
|
|
@ -543,7 +543,7 @@ class PDFSimpleFont(PDFFont):
|
|||
encoding = LITERAL_STANDARD_ENCODING
|
||||
if isinstance(encoding, dict):
|
||||
name = literal_name(encoding.get('BaseEncoding', LITERAL_STANDARD_ENCODING))
|
||||
diff = list_value(encoding.get('Differences', None))
|
||||
diff = list_value(encoding.get('Differences', []))
|
||||
self.cid2unicode = EncodingDB.get_encoding(name, diff)
|
||||
else:
|
||||
self.cid2unicode = EncodingDB.get_encoding(literal_name(encoding))
|
||||
|
|
|
@ -229,7 +229,10 @@ class PDFStream(PDFObject):
|
|||
if not isinstance(filters, list):
|
||||
filters = [filters]
|
||||
if not isinstance(params, list):
|
||||
params = [params]
|
||||
# Make sure the parameters list is the same as filters.
|
||||
params = [params] * len(filters)
|
||||
if settings.STRICT and len(params) != len(filters):
|
||||
raise PDFException("Parameters len filter mismatch")
|
||||
return zip(filters, params)
|
||||
|
||||
def decode(self):
|
||||
|
|
|
@ -138,7 +138,7 @@ KEYWORD_DICT_END = KWD(b'>>')
|
|||
def literal_name(x):
|
||||
if not isinstance(x, PSLiteral):
|
||||
if settings.STRICT:
|
||||
raise PSTypeError('Literal required: %r' % x)
|
||||
raise PSTypeError('Literal required: %r' % (x,))
|
||||
else:
|
||||
name=x
|
||||
else:
|
||||
|
|
|
@ -46,8 +46,9 @@ def compatible_encode_method(bytesorstring, encoding='utf-8', erraction='ignore'
|
|||
def apply_png_predictor(pred, colors, columns, bitspercomponent, data):
|
||||
if bitspercomponent != 8:
|
||||
# unsupported
|
||||
raise ValueError(bitspercomponent)
|
||||
nbytes = colors*columns*bitspercomponent//8
|
||||
raise ValueError("Unsupported `bitspercomponent': %d" %
|
||||
bitspercomponent)
|
||||
nbytes = colors * columns * bitspercomponent // 8
|
||||
i = 0
|
||||
buf = b''
|
||||
line0 = b'\x00' * columns
|
||||
|
@ -86,7 +87,7 @@ def apply_png_predictor(pred, colors, columns, bitspercomponent, data):
|
|||
line2 += six.int2byte(c)
|
||||
else:
|
||||
# unsupported
|
||||
raise ValueError(ft)
|
||||
raise ValueError("Unsupported predictor value: %d" % ft)
|
||||
buf += line2
|
||||
line0 = line2
|
||||
return buf
|
||||
|
|
8
setup.py
8
setup.py
|
@ -4,12 +4,16 @@ from setuptools import setup
|
|||
from pdfminer import __version__
|
||||
import sys
|
||||
|
||||
requires = ['six', 'pycrypto']
|
||||
if sys.version_info >= (3, 0):
|
||||
requires.append('chardet')
|
||||
|
||||
setup(
|
||||
name='pdfminer.six',
|
||||
version=__version__,
|
||||
packages=['pdfminer',],
|
||||
packages=['pdfminer'],
|
||||
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',
|
||||
long_description='''fork of PDFMiner using six for Python 2+3 compatibility
|
||||
|
||||
|
|
Loading…
Reference in New Issue