From 5a41b80b1ccf823b3bd0f5d4d1ac48eb476d8fdd Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 1 Aug 2009 17:36:29 -0400 Subject: [PATCH] New fix for #2913. --- src/calibre/ebooks/pdf/manipulate/crop.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/pdf/manipulate/crop.py b/src/calibre/ebooks/pdf/manipulate/crop.py index a447d43e29..de18dc66dc 100644 --- a/src/calibre/ebooks/pdf/manipulate/crop.py +++ b/src/calibre/ebooks/pdf/manipulate/crop.py @@ -108,11 +108,11 @@ def crop_pdf(pdf_path, opts, metadata=None): mo = bounding_regex.search(blines.next()) if mo == None: raise Exception('Error in bounding file %s' % opts.bounding) - page.mediaBox.upperRight = (mo.group('top_x'), mo.group('top_y')) - page.mediaBox.lowerLeft = (mo.group('bottom_x'), mo.group('bottom_y')) + page.mediaBox.upperRight = (float(mo.group('top_x')), float(mo.group('top_y'))) + page.mediaBox.lowerLeft = (float(mo.group('bottom_x')), float(mo.group('bottom_y'))) else: - page.mediaBox.upperRight = (page.bleedBox.getUpperRight_x() - opts.top_right_x, page.bleedBox.getUpperRight_y() - opts.top_right_y) - page.mediaBox.lowerLeft = (page.bleedBox.getLowerLeft_x() + opts.bottom_left_x, page.bleedBox.getLowerLeft_y() + opts.bottom_left_y) + page.mediaBox.upperRight = (page.bleedBox.getUpperRight_x() - float(opts.top_right_x), page.bleedBox.getUpperRight_y() - float(opts.top_right_y)) + page.mediaBox.lowerLeft = (page.bleedBox.getLowerLeft_x() + float(opts.bottom_left_x), page.bleedBox.getLowerLeft_y() + float(opts.bottom_left_y)) output_pdf.addPage(page) with open(opts.output, 'wb') as output_file: