diff --git a/ocrmypdf/pipeline.py b/ocrmypdf/pipeline.py index 3678da9d..6031fb67 100644 --- a/ocrmypdf/pipeline.py +++ b/ocrmypdf/pipeline.py @@ -333,13 +333,14 @@ def rasterize_preview( output_file, log, context): + pageinfo = get_pageinfo(input_file, context) + options = context.get_options() + canvas_dpi = get_canvas_square_dpi(pageinfo, options) / 2 + page_dpi = get_page_square_dpi(pageinfo, options) / 2 + ghostscript.rasterize_pdf( - input_file=input_file, - output_file=output_file, - xres=200, - yres=200, - raster_device='jpeggray', - log=log) + input_file, output_file, xres=canvas_dpi, yres=canvas_dpi, + raster_device='jpeggray', log=log, page_dpi=(page_dpi, page_dpi)) def orient_page( diff --git a/tests/test_userunit.py b/tests/test_userunit.py index c6f7313d..f60d4f2a 100644 --- a/tests/test_userunit.py +++ b/tests/test_userunit.py @@ -38,3 +38,8 @@ def test_userunit_qpdf_passes(spoof_tesseract_cache, poster, outpdf): after = PdfInfo(outpdf) assert isclose(before[0].width_inches, after[0].width_inches) + +def test_rotate_interaction(spoof_tesseract_cache, poster, outpdf): + check_ocrmypdf(poster, outpdf, '--output-type=pdf', + '--rotate-pages', + env=spoof_tesseract_cache)