mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
New fix for #2913.
This commit is contained in:
parent
81300843be
commit
5a41b80b1c
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user