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:
Kovid Goyal 2018-09-15 06:57:37 +05:30
parent 1f980f7097
commit 23ac6054e8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -260,6 +260,7 @@ class PDFOutput(OutputFormatPlugin):
import json
for href, margins in self.stored_page_margins.iteritems():
item = oeb_book.manifest.hrefs.get(href)
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))