mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-29 10:25:47 +01:00
PDF Output: Fix an error that could occur in rare circumstances when using the option to read page margins from the input document
Fixes #1792616 [conversion from ePub to PDF fails](https://bugs.launchpad.net/calibre/+bug/1792616)
This commit is contained in:
parent
1f980f7097
commit
23ac6054e8
1 changed files with 4 additions and 3 deletions
|
|
@ -260,9 +260,10 @@ def convert_text(self, oeb_book):
|
|||
import json
|
||||
for href, margins in self.stored_page_margins.iteritems():
|
||||
item = oeb_book.manifest.hrefs.get(href)
|
||||
root = item.data
|
||||
if hasattr(root, 'xpath') and margins:
|
||||
root.set('data-calibre-pdf-output-page-margins', json.dumps(margins))
|
||||
if item is not None:
|
||||
root = item.data
|
||||
if hasattr(root, 'xpath') and margins:
|
||||
root.set('data-calibre-pdf-output-page-margins', json.dumps(margins))
|
||||
|
||||
with TemporaryDirectory('_pdf_out') as oeb_dir:
|
||||
from calibre.customize.ui import plugin_for_output_format
|
||||
|
|
|
|||
Loading…
Reference in a new issue