diff --git a/ocrmypdf/main.py b/ocrmypdf/main.py index 50c2a0fb..02f8acee 100755 --- a/ocrmypdf/main.py +++ b/ocrmypdf/main.py @@ -591,9 +591,8 @@ def select_image_layer( else: pageinfo = get_pageinfo(image, pdfinfo, pdfinfo_lock) dpi = round(max(pageinfo['xres'], pageinfo['yres'], options.oversample)) - pdf_bytes = img2pdf.convert([image], dpi=dpi) with open(output_file, 'wb') as pdf: - pdf.write(pdf_bytes) + img2pdf.convert([image], dpi=dpi, outputstream=pdf) @active_if(options.pdf_renderer == 'hocr') diff --git a/requirements.txt b/requirements.txt index 5fc71a98..e152143e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ ruffus>=2.6.3 Pillow>=2.4.0 reportlab>=3.1.44 PyPDF2>=1.25.1 -img2pdf>=0.1.5 \ No newline at end of file +git+https://github.com/jbarlow83/img2pdf.git@1261741136dcbfed65355ed93f4930617a55feee#egg=img2pdf