1
0
Fork 0
forked from josch/img2pdf

CCITTFaxDecode filter must be in an array

This commit is contained in:
Johannes 'josch' Schauer 2018-07-18 01:14:06 +02:00
parent 48d5b4d7af
commit 7de174f4b5
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 3 additions and 3 deletions

View file

@ -406,7 +406,7 @@ class pdfdoc(object):
ofilter = PdfName.JPXDecode ofilter = PdfName.JPXDecode
self.writer.version = "1.5" # jpeg2000 needs pdf 1.5 self.writer.version = "1.5" # jpeg2000 needs pdf 1.5
elif imgformat is ImageFormat.CCITTGroup4: elif imgformat is ImageFormat.CCITTGroup4:
ofilter = PdfName.CCITTFaxDecode ofilter = [PdfName.CCITTFaxDecode]
else: else:
ofilter = PdfName.FlateDecode ofilter = PdfName.FlateDecode

View file

@ -556,7 +556,7 @@ def test_suite():
self.assertIn( self.assertIn(
imgprops.Filter, [PdfName.DCTDecode, PdfName.JPXDecode, imgprops.Filter, [PdfName.DCTDecode, PdfName.JPXDecode,
PdfName.FlateDecode, PdfName.FlateDecode,
PdfName.CCITTFaxDecode]) [PdfName.CCITTFaxDecode]])
# test if the image has correct size # test if the image has correct size
self.assertEqual(imgprops.Width, str(orig_img.size[0])) self.assertEqual(imgprops.Width, str(orig_img.size[0]))
@ -568,7 +568,7 @@ def test_suite():
self.assertEqual( self.assertEqual(
cur_page.Resources.XObject.Im0.stream, cur_page.Resources.XObject.Im0.stream,
convert_load(orig_imgdata)) convert_load(orig_imgdata))
elif imgprops.Filter == PdfName.CCITTFaxDecode: elif imgprops.Filter == [PdfName.CCITTFaxDecode]:
tiff_header = tiff_header_for_ccitt( tiff_header = tiff_header_for_ccitt(
int(imgprops.Width), int(imgprops.Height), int(imgprops.Width), int(imgprops.Height),
int(imgprops.Length), 4) int(imgprops.Length), 4)