PDF Output: Option to control title of generated Table of Contents

Fixes #1245076 [[Enhancement] Add PDF TOC Title, More Margin Options and ePub TOC Heading 1](https://bugs.launchpad.net/calibre/+bug/1245076)
This commit is contained in:
Kovid Goyal 2013-10-27 08:51:15 +05:30
parent b05be6f902
commit 9d5ea30749
4 changed files with 18 additions and 2 deletions

View File

@ -112,6 +112,9 @@ class PDFOutput(OutputFormatPlugin):
OptionRecommendation(name='pdf_add_toc', recommended_value=False, OptionRecommendation(name='pdf_add_toc', recommended_value=False,
help=_('Add a Table of Contents at the end of the PDF that lists page numbers. ' help=_('Add a Table of Contents at the end of the PDF that lists page numbers. '
'Useful if you want to print out the PDF. If this PDF is intended for electronic use, use the PDF Outline instead.')), 'Useful if you want to print out the PDF. If this PDF is intended for electronic use, use the PDF Outline instead.')),
OptionRecommendation(name='toc_title', recommended_value=None,
help=_('Title for generated table of contents.')
),
]) ])
def convert(self, oeb_book, output_path, input_plugin, opts, log): def convert(self, oeb_book, output_path, input_plugin, opts, log):

View File

@ -64,7 +64,7 @@ def toc_as_html(toc, pdf, opts):
) )
), ),
BODY( BODY(
H1(_('Table of Contents')), H1(opts.toc_title or _('Table of Contents')),
TABLE(), TABLE(),
) )
) )

View File

@ -23,7 +23,7 @@ class PluginWidget(Widget, Ui_Form):
'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',
'pdf_footer_template', 'pdf_header_template', 'pdf_add_toc', 'pdf_footer_template', 'pdf_header_template', 'pdf_add_toc', 'toc_title',
]) ])
self.db, self.book_id = db, book_id self.db, self.book_id = db, book_id

View File

@ -232,6 +232,19 @@
</property> </property>
</widget> </widget>
</item> </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>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>