PDF Output: Default to generating PDFs with a page size of letter instead of taking the page size from the output profile. This avoids user confusion/bug reports about PDF Output having "too large fonts". There is a new option "Use profile size" to have the conversion use the output profile page size instead.

This commit is contained in:
Kovid Goyal 2017-04-13 09:08:13 +05:30
parent 9aea1e6fc8
commit bef606f27c
5 changed files with 60 additions and 72 deletions

View File

@ -805,12 +805,13 @@ Converting to PDF
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
The first, most important, setting to decide on when converting to PDF is the page The first, most important, setting to decide on when converting to PDF is the page
size. By default, calibre uses a page size defined by the current size. By default, calibre uses a page size of "U.S. Letter". You can change this
:guilabel:`Output profile`. So if your output profile is set to Kindle, calibre to another standard page size or a completely custom size in the :guilabel:`PDF Output`
section of the conversion dialog. If you are generating a PDF to be used ona
specific device, you can turn on the option to use the page size from the
:guilabel:`output profile` instead. So if your output profile is set to Kindle, calibre
will create a PDF with page size suitable for viewing on the small kindle will create a PDF with page size suitable for viewing on the small kindle
screen. However, if you view this PDF file on a computer screen, then it will screen.
appear to have too large fonts. To create "normal" sized PDFs, use the
:guilabel:`Override page size` option under :guilabel:`PDF Output` in the conversion dialog.
Headers and Footers Headers and Footers
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^

View File

@ -52,11 +52,10 @@ class PDFOutput(OutputFormatPlugin):
file_type = 'pdf' file_type = 'pdf'
options = set([ options = set([
OptionRecommendation(name='override_profile_size', recommended_value=False, OptionRecommendation(name='use_profile_size', recommended_value=False,
help=_('Normally, the PDF page size is set by the output profile' help=_('Instead of using the paper size specified in the PDF Output options,'
' chosen under the page setup options. This option will cause the ' ' use a paper size corresponding to the current output profile.'
' page size settings under PDF Output to override the ' ' Useful if you want to generate a PDF for viewing on a specific device.')),
' size specified by the output profile.')),
OptionRecommendation(name='unit', recommended_value='inch', OptionRecommendation(name='unit', recommended_value='inch',
level=OptionRecommendation.LOW, short_switch='u', choices=UNITS, level=OptionRecommendation.LOW, short_switch='u', choices=UNITS,
help=_('The unit of measure for page sizes. Default is inch. Choices ' help=_('The unit of measure for page sizes. Default is inch. Choices '

View File

@ -27,9 +27,7 @@ from calibre.ptempfile import PersistentTemporaryFile
def get_page_size(opts, for_comic=False): # {{{ def get_page_size(opts, for_comic=False): # {{{
use_profile = not (opts.override_profile_size or use_profile = opts.use_profile_size and opts.output_profile.short_name != 'default' and opts.output_profile.width <= 9999
opts.output_profile.short_name == 'default' or
opts.output_profile.width > 9999)
if use_profile: if use_profile:
w = (opts.output_profile.comic_screen_size[0] if for_comic else w = (opts.output_profile.comic_screen_size[0] if for_comic else
opts.output_profile.width) opts.output_profile.width)

View File

@ -24,7 +24,7 @@ class PluginWidget(Widget, Ui_Form):
def __init__(self, parent, get_option, get_help, db=None, book_id=None): def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, [ Widget.__init__(self, parent, [
'override_profile_size', 'paper_size', 'custom_size', 'use_profile_size', 'paper_size', 'custom_size',
'preserve_cover_aspect_ratio', 'pdf_serif_family', 'unit', 'preserve_cover_aspect_ratio', 'pdf_serif_family', 'unit',
'pdf_sans_family', 'pdf_mono_family', 'pdf_standard_font', 'pdf_sans_family', 'pdf_mono_family', 'pdf_standard_font',
'pdf_default_font_size', 'pdf_mono_font_size', 'pdf_page_numbers', 'pdf_default_font_size', 'pdf_mono_font_size', 'pdf_page_numbers',

View File

@ -15,23 +15,13 @@
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_10"> <widget class="QCheckBox" name="opt_use_profile_size">
<property name="text"> <property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt; The paper size settings below only take effect if you enable the &quot;Override&quot; checkbox below. Otherwise the size from the output profile will be used.</string> <string>&amp;Use the paper size set in output profile</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0">
<widget class="QCheckBox" name="opt_override_profile_size">
<property name="text">
<string>&amp;Override paper size set in output profile</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&amp;Paper Size:</string> <string>&amp;Paper Size:</string>
@ -41,10 +31,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="opt_paper_size"/> <widget class="QComboBox" name="opt_paper_size"/>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>&amp;Custom size:</string> <string>&amp;Custom size:</string>
@ -54,7 +44,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLineEdit" name="opt_custom_size"> <widget class="QLineEdit" name="opt_custom_size">
@ -87,21 +77,41 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="opt_preserve_cover_aspect_ratio"> <widget class="QCheckBox" name="opt_preserve_cover_aspect_ratio">
<property name="text"> <property name="text">
<string>Preserve &amp;aspect ratio of cover</string> <string>Preserve &amp;aspect ratio of cover</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0" colspan="2"> <item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="opt_pdf_page_numbers"> <widget class="QCheckBox" name="opt_pdf_page_numbers">
<property name="text"> <property name="text">
<string>Add page &amp;numbers to the bottom of every page</string> <string>Add page &amp;numbers to the bottom of every page</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="opt_pdf_add_toc">
<property name="text">
<string>Add a printable &amp;Table of Contents at the end</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&amp;Title for ToC:</string>
</property>
<property name="buddy">
<cstring>opt_toc_title</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="opt_toc_title"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Serif famil&amp;y:</string> <string>Serif famil&amp;y:</string>
@ -111,10 +121,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1"> <item row="9" column="1">
<widget class="QFontComboBox" name="opt_pdf_serif_family"/> <widget class="QFontComboBox" name="opt_pdf_serif_family"/>
</item> </item>
<item row="11" column="0"> <item row="10" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Sans fami&amp;ly:</string> <string>Sans fami&amp;ly:</string>
@ -124,10 +134,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="1"> <item row="10" column="1">
<widget class="QFontComboBox" name="opt_pdf_sans_family"/> <widget class="QFontComboBox" name="opt_pdf_sans_family"/>
</item> </item>
<item row="12" column="0"> <item row="11" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>&amp;Monospace family:</string> <string>&amp;Monospace family:</string>
@ -137,10 +147,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1"> <item row="11" column="1">
<widget class="QFontComboBox" name="opt_pdf_mono_family"/> <widget class="QFontComboBox" name="opt_pdf_mono_family"/>
</item> </item>
<item row="13" column="0"> <item row="12" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>S&amp;tandard font:</string> <string>S&amp;tandard font:</string>
@ -150,10 +160,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="1"> <item row="12" column="1">
<widget class="QComboBox" name="opt_pdf_standard_font"/> <widget class="QComboBox" name="opt_pdf_standard_font"/>
</item> </item>
<item row="14" column="0"> <item row="13" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Default font si&amp;ze:</string> <string>Default font si&amp;ze:</string>
@ -163,14 +173,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="1"> <item row="13" column="1">
<widget class="QSpinBox" name="opt_pdf_default_font_size"> <widget class="QSpinBox" name="opt_pdf_default_font_size">
<property name="suffix"> <property name="suffix">
<string> px</string> <string> px</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="0"> <item row="14" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
<string>Monospace &amp;font size:</string> <string>Monospace &amp;font size:</string>
@ -180,14 +190,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1"> <item row="14" column="1">
<widget class="QSpinBox" name="opt_pdf_mono_font_size"> <widget class="QSpinBox" name="opt_pdf_mono_font_size">
<property name="suffix"> <property name="suffix">
<string> px</string> <string> px</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="17" column="0" colspan="2"> <item row="15" column="0" colspan="2">
<widget class="QGroupBox" name="page_margins_box">
<property name="title">
<string>Page margins</string>
</property>
</widget>
</item>
<item row="16" column="0" colspan="2">
<widget class="QGroupBox" name="template_box"> <widget class="QGroupBox" name="template_box">
<property name="title"> <property name="title">
<string>Page headers and footers</string> <string>Page headers and footers</string>
@ -235,33 +252,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="opt_pdf_add_toc">
<property name="text">
<string>Add a printable &amp;Table of Contents at the end</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="opt_toc_title"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&amp;Title for ToC:</string>
</property>
<property name="buddy">
<cstring>opt_toc_title</cstring>
</property>
</widget>
</item>
<item row="16" column="0" colspan="2">
<widget class="QGroupBox" name="page_margins_box">
<property name="title">
<string>Page margins</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>