From 7de174f4b523ea8ac1a23e472fabba4afd5a00fc Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Wed, 18 Jul 2018 01:14:06 +0200 Subject: [PATCH] CCITTFaxDecode filter must be in an array --- src/img2pdf.py | 2 +- src/tests/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index 4632c7a..767b82e 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -406,7 +406,7 @@ class pdfdoc(object): ofilter = PdfName.JPXDecode self.writer.version = "1.5" # jpeg2000 needs pdf 1.5 elif imgformat is ImageFormat.CCITTGroup4: - ofilter = PdfName.CCITTFaxDecode + ofilter = [PdfName.CCITTFaxDecode] else: ofilter = PdfName.FlateDecode diff --git a/src/tests/__init__.py b/src/tests/__init__.py index 77b8148..b1c1797 100644 --- a/src/tests/__init__.py +++ b/src/tests/__init__.py @@ -556,7 +556,7 @@ def test_suite(): self.assertIn( imgprops.Filter, [PdfName.DCTDecode, PdfName.JPXDecode, PdfName.FlateDecode, - PdfName.CCITTFaxDecode]) + [PdfName.CCITTFaxDecode]]) # test if the image has correct size self.assertEqual(imgprops.Width, str(orig_img.size[0])) @@ -568,7 +568,7 @@ def test_suite(): self.assertEqual( cur_page.Resources.XObject.Im0.stream, convert_load(orig_imgdata)) - elif imgprops.Filter == PdfName.CCITTFaxDecode: + elif imgprops.Filter == [PdfName.CCITTFaxDecode]: tiff_header = tiff_header_for_ccitt( int(imgprops.Width), int(imgprops.Height), int(imgprops.Length), 4)