No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
To create a custom cover sheet with more than just the title and a background, you need to add some custom formatting to a PDF template. | To create a custom cover sheet with more than just the title and a background, you need to add some custom formatting to a PDF template. | ||
== | == Example layout == | ||
[[File:Manual:PDFcreator book cover.png|alt=Cover page with logo, background image, title, subtitle and contact information|center|thumb|566x566px|Custom cover page]] | [[File:Manual:PDFcreator book cover.png|alt=Cover page with logo, background image, title, subtitle and contact information|center|thumb|566x566px|Custom cover page]] | ||
{{Textbox|boxtype=important|header=Important!|text=When you customize the cover sheet as described, you need to maintain it exclusively via the page ''MediaWiki:PDFCreator''. | {{Textbox|boxtype=important|header=Important!|text=When you customize the cover sheet as described, you need to maintain it exclusively via the page ''MediaWiki:PDFCreator''. | ||
| Line 25: | Line 25: | ||
# '''Open''' the page in edit mode. | # '''Open''' the page in edit mode. | ||
# '''Switch''' to the tab ''Document preface''. | # '''Switch''' to the tab ''Document preface''. | ||
# '''Replace''' the default content with the following content:<syntaxhighlight lang="css"> | # '''Replace''' the default content with the following content:<syntaxhighlight lang="css"><div class="pdfcreator-intro"> | ||
<div class="pdfcreator-intro"> | |||
<div class="pdfcreator-intro-logo">{{{logo}}}</div> | <div class="pdfcreator-intro-logo">{{{logo}}}</div> | ||
<div class="pdfcreator-intro-title">{{{book-title}}} | <div class="pdfcreator-intro-title">{{{book-title}}} | ||
| Line 39: | Line 37: | ||
<div>Other contact info</div> | <div>Other contact info</div> | ||
</div> | </div> | ||
</div> | </div></syntaxhighlight> | ||
</syntaxhighlight> | |||
# '''Switch''' to the tab ''Styles''. | # '''Switch''' to the tab ''Styles''. | ||
# '''Append''' the following CSS rules to the end of the existing CSS styles.<syntaxhighlight lang="css"> | # '''Append''' the following CSS rules to the end of the existing CSS styles.<syntaxhighlight lang="css">/*Custom cover sheet styles*/ | ||
/* | |||
.pdfcreator-type-intro { | .pdfcreator-type-intro { | ||
background-color: #3E5389; /*only visible if no cover-image is available */ | |||
background- | background-position:center 1.5cm; | ||
max-height:14cm; | |||
overflow:hidden; | |||
} | |||
.pdfcreator-intro-logo { | |||
position: absolute; | |||
padding: 0.3cm 1.75cm; | |||
width: 21cm; | width: 21cm; | ||
height: | max-height: 2.6cm; | ||
background- | overflow: hidden; | ||
background-color: #ffffff; | |||
} | } | ||
| Line 78: | Line 82: | ||
left:1.75cm; | left:1.75cm; | ||
width: 17.5cm; | width: 17.5cm; | ||
} | }</syntaxhighlight>[[File:Extension PDFCreator template page.png|alt=Code view of the template example "StandardHandbookPDF"|center|thumb|650x650px|PDFCreator template page]] | ||
Print a book with this template. There are two ways of applying the new template: | |||
Adding it to the metadata of a book: | |||
[[File:PDFCreator custom template metadata.png|alt=Metadata dialog with new template selected|center|thumb|550x550px|Book metadata ]] | |||
Selecting it from the Export dialog of a book page in Book print mode: | |||
[[File:Manual:Manual PDFCreator select template in export dialog.png|alt=export dialog with selected template in Book export mode|center|thumb|400x400px|Export dialog on a wiki page that is part of a book]] | |||
== Cover image considerations == | |||
The PDFCreator is looking for a cover image in the following places: | |||
. | * the <code>bookshelf-image</code> in the metadata of the book. If none exists: | ||
* the <code>default cover image</code> set in the [[Manual:Extension/BlueSpiceConfigManager#PDFCreator|Config manager PDFCreator settings]]. If none exists | |||
The cover image is only applied if the Document preface uses the wrapper class "pdf-creator-info":<syntaxhighlight lang="html"> | |||
<div class="pdfcreator-intro"> | |||
... | |||
</div> | |||
</syntaxhighlight>If no cover image exists, the template we just created shows a blue background color instead:<syntaxhighlight lang="css"> | |||
.pdfcreator-type-intro { | .pdfcreator-type-intro { | ||
background- | background-color: #3E5389; /*only visible if no cover-image is available */ | ||
... | |||
} | } | ||
</syntaxhighlight>[[File: | </syntaxhighlight> | ||
== Title or book-title? == | |||
The template is created to print PDFs from books. It assumes that each book has a book-title set in the book's meta data. If no book-title exists, '''no title is printed on the cover page''': | |||
[[File:PDFCreator book title and subtitle.png|alt=Metadata dialog of the bookshelf|center|thumb|550x550px|Book title and subtitle settings]] | |||
If you want to be flexible and use the PDF template also in Page export mode or for books that do not have a book-title defined, you need to create a separate PDF-template where you define <code><nowiki>{{{title}}}</nowiki></code> or <code><nowiki>{{PAGENAME}}</nowiki></code> instead of <code><nowiki>{{{book-title}}}</nowiki></code> in the ''Document preface'' tab, since there currently is no fallback-mechanism. | |||
== Variations == | |||
=== Removing the logo === | |||
If you do not want to show the wiki's logo at the top of the cover sheet, you can simply comment out the line that inserts the logo: | |||
<syntaxhighlight lang="html"> | |||
<div class="pdfcreator-intro"> | |||
<!--<div class="pdfcreator-intro-logo">{{{logo}}}</div>--> | |||
<div class="pdfcreator-intro-title">{{{book-title}}} | |||
<div class="pdfcreator-intro-subtitle">{{{book-subtitle}}}</div> | |||
</div> | |||
<div class="pdfcreator-intro-text"> | |||
<div>Adress line 1</div> | |||
<div>Adress line 2</div> | |||
<div>City</div> | |||
<div>Other contact info</div> | |||
</div> | |||
</div> | |||
</syntaxhighlight> | |||
== Inverting the colors == | |||
If you prefer a dark background and white text, you can use the following css instead of the | |||
* | |||
Revision as of 13:49, 21 October 2025
To create a custom cover sheet with more than just the title and a background, you need to add some custom formatting to a PDF template.
Example layout

When you customize the cover sheet as described, you need to maintain it exclusively via the page MediaWiki:PDFCreator.
Changing the cover page from the page Special:PDF templates will overwrite your changes.
Copying an existing template
To create a PDF template with a custom cover sheet, we first copy an existing template. For the example we copy the StandardBookPDF template to a new template called StandardHandbookPDF.
To create a new PDF template from an existing one:
- Go to the page Special:PDF_templates.
- Copy the template StandardBookPDF.

Copy a template - Enter a name for the new template.
- Click Copy.
Customizing the template
From the page Special:PDF_templates click on the template name for your new template. StandardHandbookPDF. This brings up the page MediaWiki:PDFCreator.
To customize the cover sheet:
- Select your PDF template. This brings up the PDFCreator page for your template.
- Open the page in edit mode.
- Switch to the tab Document preface.
- Replace the default content with the following content:
<div class="pdfcreator-intro"> <div class="pdfcreator-intro-logo">{{{logo}}}</div> <div class="pdfcreator-intro-title">{{{book-title}}} <div class="pdfcreator-intro-subtitle">{{{book-subtitle}}}</div> </div> <div class="pdfcreator-intro-text"> <div>Adress line 1</div> <div>Adress line 2</div> <div>City</div> <div>Other contact info</div> </div> </div>
- Switch to the tab Styles.
- Append the following CSS rules to the end of the existing CSS styles.
/*Custom cover sheet styles*/ .pdfcreator-type-intro { background-color: #3E5389; /*only visible if no cover-image is available */ background-position:center 1.5cm; max-height:14cm; overflow:hidden; } .pdfcreator-intro-logo { position: absolute; padding: 0.3cm 1.75cm; width: 21cm; max-height: 2.6cm; overflow: hidden; background-color: #ffffff; } .pdfcreator-intro-title { top: 15.5cm; font-size: 32px; color: #3E5389; font-weight: 800; line-height: 1.5em; } .pdfcreator-intro-subtitle { display:block; font-size: 18px; color: #3E5389; font-weight: 600; line-height: 1.3em; margin-top:0.5cm; } .pdfcreator-intro-text { position:absolute; font-size: 14px; font-weight: 600; line-height: 1.3em; top:25.5cm; left:1.75cm; width: 17.5cm; }

PDFCreator template page
Print a book with this template. There are two ways of applying the new template:
Adding it to the metadata of a book:

Selecting it from the Export dialog of a book page in Book print mode:

Cover image considerations
The PDFCreator is looking for a cover image in the following places:
- the
bookshelf-imagein the metadata of the book. If none exists: - the
default cover imageset in the Config manager PDFCreator settings. If none exists
The cover image is only applied if the Document preface uses the wrapper class "pdf-creator-info":
<div class="pdfcreator-intro">
...
</div>
If no cover image exists, the template we just created shows a blue background color instead:
.pdfcreator-type-intro {
background-color: #3E5389; /*only visible if no cover-image is available */
...
}
Title or book-title?
The template is created to print PDFs from books. It assumes that each book has a book-title set in the book's meta data. If no book-title exists, no title is printed on the cover page:

If you want to be flexible and use the PDF template also in Page export mode or for books that do not have a book-title defined, you need to create a separate PDF-template where you define {{{title}}} or {{PAGENAME}} instead of {{{book-title}}} in the Document preface tab, since there currently is no fallback-mechanism.
Variations
Removing the logo
If you do not want to show the wiki's logo at the top of the cover sheet, you can simply comment out the line that inserts the logo:
<div class="pdfcreator-intro">
<!--<div class="pdfcreator-intro-logo">{{{logo}}}</div>-->
<div class="pdfcreator-intro-title">{{{book-title}}}
<div class="pdfcreator-intro-subtitle">{{{book-subtitle}}}</div>
</div>
<div class="pdfcreator-intro-text">
<div>Adress line 1</div>
<div>Adress line 2</div>
<div>City</div>
<div>Other contact info</div>
</div>
</div>
Inverting the colors
If you prefer a dark background and white text, you can use the following css instead of the