From 9f87cd7f9929a7d81da24ca0ca4672e52482292d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jul 2019 21:42:47 +0530 Subject: [PATCH] Add a note about using page margins from the input document --- manual/conversion.rst | 25 +++++++++++++++++++++++++ src/calibre/gui2/convert/pdf_output.py | 7 ------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/manual/conversion.rst b/manual/conversion.rst index e962caff63..8bdefe8e68 100644 --- a/manual/conversion.rst +++ b/manual/conversion.rst @@ -898,3 +898,28 @@ changes you like. .calibre-pdf-toc .level-1 td:first-of-type { padding-left: 1.4em } .calibre-pdf-toc .level-2 td:first-of-type { padding-left: 2.8em } + + +Custom page margins for individual HTML files +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you are converting an EPUB of AZW3 file with multiple individual HTML files +inside it and you want to change the page margins for a particular HTML file +you can add the following style block to the HTML file using the calibre +editor: + +.. code-block:: html + + + + +Then, in the PDF output section of the conversion dialog, turn on the +option to :guilabel:`Use page margins from the document being converted`. +Now all pages generated from this HTML file will have ``10pt`` margins. diff --git a/src/calibre/gui2/convert/pdf_output.py b/src/calibre/gui2/convert/pdf_output.py index 98e0b99b43..7c73be7d97 100644 --- a/src/calibre/gui2/convert/pdf_output.py +++ b/src/calibre/gui2/convert/pdf_output.py @@ -43,7 +43,6 @@ class PluginWidget(Widget, Ui_Form): self.initialize_options(get_option, get_help, db, book_id) self.layout().setFieldGrowthPolicy(self.layout().ExpandingFieldsGrow) self.template_box.layout().setFieldGrowthPolicy(self.layout().AllNonFixedFieldsGrow) - self.toggle_margins() self.profile_size_toggled() def profile_size_toggled(self): @@ -52,17 +51,11 @@ class PluginWidget(Widget, Ui_Form): self.opt_custom_size.setEnabled(enabled) self.opt_unit.setEnabled(enabled) - def toggle_margins(self): - enabled = not self.opt_pdf_use_document_margins.isChecked() - for which in 'left top right bottom'.split(): - getattr(self, 'opt_pdf_page_margin_' + which).setEnabled(enabled) - def setupUi(self, *a): Ui_Form.setupUi(self, *a) v = self.page_margins_box.v = QVBoxLayout(self.page_margins_box) self.opt_pdf_use_document_margins = c = QCheckBox(_('Use page margins from the &document being converted')) v.addWidget(c) - c.stateChanged.connect(self.toggle_margins) h = self.page_margins_box.h = QHBoxLayout() l = self.page_margins_box.l = QFormLayout() r = self.page_margins_box.r = QFormLayout()