No edit summary Tags: Reverted 2017 source edit |
No edit summary Tag: 2017 source edit |
||
(32 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:PDF export (template customization) | {{DISPLAYTITLE:PDF export (with template customization)}} | ||
== Exporting a page or a book == | == Exporting a page or a book == | ||
To print a page to PDF, click on the page-icon in the page tools. This opens the export dialog field. | To print a page to PDF, click on the page-icon in the page tools. This opens the export dialog field. | ||
[[File:PDF export dialog.png|alt=dialog with dropdown menus for selecting export mode and template|center|thumb|450x450px|PDF export dialog]] | |||
Select the export settings. | Select the export settings. | ||
Line 10: | Line 9: | ||
** ''Page:'' Prints the page. | ** ''Page:'' Prints the page. | ||
** ''Page with subpages:'' Prints the page and all its subpages. This option is only shown if the page has subpages. | ** ''Page with subpages:'' Prints the page and all its subpages. This option is only shown if the page has subpages. | ||
** ''Page with linked pages:'' Prints the page and the pages that are linked directly from this page | ** ''Page with linked pages:'' Prints the page and the pages that are linked directly from this page | ||
* '''Template:''' | * '''Template:''' | ||
** ''StandardPDF:'' This prints the page or pages without a cover sheet (unless the template has been edited). | ** ''StandardPDF:'' This prints the page or pages without a cover sheet (unless the template has been edited). | ||
** ''StandardBookPDF:'' This adds a cover sheet to the PDF (unless the template has been edited). | ** ''StandardBookPDF:'' This adds a cover sheet to the PDF (unless the template has been edited). | ||
{{Textbox|boxtype=note|header=|text=Whether linked pages should be considered in the PDF export is defined in the chosen export template.|icon=yes}} | |||
By default, the template ''StandardPDF'' shows the wiki's logo (from the [[Manual:Extension/FlexiSkin|skin settings page]]). If there are no custom settings, the default BlueSpice logo is used. | By default, the template ''StandardPDF'' shows the wiki's logo (from the [[Manual:Extension/FlexiSkin|skin settings page]]). If there are no custom settings, the default BlueSpice logo is used. | ||
[[File: | === Exporting media links === | ||
Media links (=links that point directly to the file on the server) will add an attachment to the exported PDF File. This is independent of the chosen export mode (Page, Page with linked pages). | |||
=== Exporting pages with linked pages === | |||
When pages are exported with their linked pages, link types are processed as follows: | |||
* '''Media links''' will add an attachment to the exported PDF File | |||
* '''File links''' are clickable and forward to the corresponding file page | |||
* '''Mentions''' are clickable and forward to the user page | |||
== Adding a new template == | |||
By default, the wiki provides two PDF templates: | |||
* '''StandardPDF:''' Template without a cover page for the single-page export. | |||
* '''StandardBookPDF:''' Template with a cover page for the book export. | |||
Starting with '''BlueSpice 5.1''', PDF templates can be created from the page ''Special:PDF templates''. | |||
=== Copy an existing template === | |||
'''To create a new PDF template:''' | |||
# '''Go''' to the page ''Special:PDF_templates''. | |||
# '''Copy''' an existing template.[[File:PDF templates - copy.png|alt=special page "PDF templates" with selected standard book pdf to be copied|center|thumb|600x600px|Copy a template]] | |||
# '''Enter''' a name for the new template. | |||
# '''Click''' ''Copy.'' | |||
'''Click''' ''Edit template'' to start customizing your template. | |||
[[File:Pdf templates - properties.png|alt=PDF templates page with the edit link of the new template |center|thumb|600x600px|Edit template properties]] | |||
=== Select general template properties === | |||
# '''Select''' the page orientation and the [[Manual:Extension/PDFCreator#Properties|general export properties]] (for example, whether to show the Table of Contents for each page or whether to include links to pages that are not exported in the PDF itself). | |||
# '''Click''' Next. | |||
=== Select the template elements === | |||
Select the checkboxes for each element you want to include in your template: | |||
* Header: Page header for the template pages | |||
* Footer: Page footer for the template pages | |||
* Document preface: Cover page | |||
* Document appendix: Additional page that is added at the end of the pdf. It is formatted like the content pages (with header and footer) and adds to the PDF page count. | |||
'''Click''' ''Configure'' for each template element to design the layout. | |||
=== Configure the header === | |||
The header elements can consist of a header image (usually your logo) and some text (which can be a combination of predefined parameters and your own text). | |||
[[File:Pdf templates - header editor.png|alt=Edit idalog for the header section|center|thumb|450x450px|Defining the header]] | |||
If you want to show an image that is different from your wiki logo, you can select "Use custom logo" and enter an existing image name or upload a new image. | |||
== | === Configure the footer === | ||
By default, the wiki provides [[mediawikiwiki:Help:Magic_words#Localization_functions|localization system messages]] for each footer section. Use system messages if you want to support the language settings of your users. For example, in an English wiki, the English system message for <code><nowiki>{{int:pdfcreator-pdf-disclaimer}}</nowiki></code> can be changed on the page <code>MediaWiki:pdfcreator-pdf-disclaimer</code>. the German language version on page <code>MediaWiki:pdfcreator-pdf-disclaimer/de</code>. | |||
Alternatively, you can simply type your own text if the PDF export does not have to consider user languages. Or leave the section blank if you don't want to print text. | |||
=== Configure the document preface (PDF cover) === | |||
You can define the following elements on your cover page: | |||
Background image: | |||
* If a bookshelf image exists, the bookshelf image is used as cover image for the Book PDF export. | |||
* If no bookshelf image exists, the default image defined in the Configuration Manager is used as cover image for the Book PDF export. | |||
* If a custom image is defined in the PDF template, the custom image will be used for the Book PDF export. | |||
If you do not want to use any background image on your PDF cover page, all three locations for defining a book image must be empty. | |||
=== Properties === | |||
The following properties can be configured:<syntaxhighlight lang="json"> | |||
{ | |||
"embed-page-toc": true, | |||
"nsPrefix": true, | |||
"attachments": true, | |||
"suppress-links": false, | |||
"no-redirect": true, | |||
"coverBackground": "" | |||
} | |||
</syntaxhighlight> | |||
{| class="wikitable" style="width: 100%;" | |||
! style="" |Label | |||
! style="" |Name | |||
! style="" |Default value | |||
! style="" |Description | |||
|- | |||
| style="" |Show namespace prefix | |||
| style="" |nsPrefix | |||
| style="" |true | |||
| style="" |The namespace prefix of pages is not printed in the page titles. | |||
|- | |||
| style="" |Show table of contents | |||
| style="" |embed-page-toc | |||
| style="" |true | |||
| style="" |Include the table of contents of each exported page. | |||
|- | |||
| style="" |Ignore redirect | |||
| style="" |no-redirect | |||
| style="" |false | |||
| style="" |If links are redirecting to a different page, the target page is not included in the pdf. | |||
|- | |||
| style="" |Allow attachments | |||
| style="" |attachments | |||
| style="" |true | |||
| style="" |If files are directly linked with syntax <code>Media:</code> , the files are also attached in the pdf. | |||
|- | |||
| style="" |Disable links in PDF | |||
| style="" |suppress-links | |||
| style="" |false | |||
| style="" |Replaces all links in the pdf with a span-element if they do not link to a target within the pdf. | |||
|- | |||
| style="" | - | |||
| style="" |coverBackground | |||
| style="" |<File:filename.png> | |||
| style="" |This property is set programmatically when a custom cover background image is provided. | |||
|} | |||
==PDF template slots== | |||
All templates are saved as subpages of <code>MediaWiki:PDFCreator</code>. | |||
There, you can see the syntax for the different template elements. | |||
=== Template elements === | === Template elements === | ||
Each template consists of the same elements: | Each template consists of the same elements (slots): | ||
{| class="wikitable" style="width: 100%;" | {| class="wikitable" style="width: 100%;" | ||
!Header | ! style="" |Template slot | ||
|The page header of each PDF page. The basic structure is:<syntaxhighlight lang="html"> | ! style="" |Description | ||
|- | |||
! style="" |Header | |||
| style="" |The page header of each PDF page. The basic structure is:<syntaxhighlight lang="html"> | |||
<div class="pdfcreator-runningheaderfix"> | <div class="pdfcreator-runningheaderfix"> | ||
<table> | <table> | ||
Line 50: | Line 155: | ||
</table> | </table> | ||
</div> | </div> | ||
</syntaxhighlight> | </syntaxhighlight>{{Textbox|boxtype=important|header=Important!|text=The class ''.pdfcreator-runningheaderfix'' is necessary to top-align the header on the page. It works in conjunction with the class-declaration in the "Styles" tab of the template. Both need to be modified together.|icon=yes}} | ||
|- | |- | ||
!Content | ! style="" |Content | ||
|The content layout. The basic structure is:<syntaxhighlight lang="html"> | | style="" |The content layout. The basic structure is:<syntaxhighlight lang="html"> | ||
{{{content}}} | {{{content}}} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
!Footer | ! style="" |Footer | ||
|The page footer of each PDF page. The basic structure is:<syntaxhighlight lang="html"> | | style="" |The page footer of each PDF page. The basic structure is:<syntaxhighlight lang="html"> | ||
<div class="pdfcreator- | <div class="pdfcreator-runningfooterfix"> | ||
<table> | <table> | ||
<tr> | <tr> | ||
<td> | <td> | ||
< | <span>{{int:pdfcreator-pdf-disclaimer}}</span> | ||
</td> | |||
<td> | |||
<span>{{int:pdfcreator-pdf-export-time}}:{{#time:d.m.Y|now}}</span> | |||
</td> | </td> | ||
<td> | <td> | ||
< | <span>{{int:pdfcreator-pdf-param-currentpagenumber-label}} </span>{{{currentpagenumber}}} | ||
<span> {{int:pdfcreator-pdf-param-totalpagescount-label}} </span>{{{totalpagescount}}} | |||
</td> | </td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
</div> | </div> | ||
</syntaxhighlight> | </syntaxhighlight>{{Textbox|boxtype=important|header=Important!|text=The class ''.pdfcreator-runningfooterfix'' is necessary to top-align the header on the page. It works in conjunction with the class-declaration in the "Styles" tab of the template. Both need to be modified together.|icon=yes}} | ||
|- | |- | ||
!Document preface | ! style="" |Document preface | ||
|The cover page. It is meant for the book export, but can also be used for a page export. The basic structure for a book cover page is:<syntaxhighlight lang="html"> | | style="" |The cover page. It is meant for the book export, but can also be used for a page export. The basic structure for a book cover page is:<syntaxhighlight lang="html"> | ||
<div class="pdfcreator-intro"> | <div class="pdfcreator-intro"> | ||
<div class="pdfcreator-intro-title">{{{title}}}</div> | <div class="pdfcreator-intro-title">{{{title}}}</div> | ||
</div> | </div> | ||
</syntaxhighlight> | </syntaxhighlight>{{Textbox|boxtype=important|header=Important!|text=The class ''.pdfcreator-intro'' is necessary to display the image for the {{{logo}}}-parameter. Without this class present in the template, the {{{logo}}}-parameter has no effect.|icon=yes}} | ||
|- | |||
! style="" |Document appendix | |||
| style="" |The last page of the PDF export. It has no predefined basic structure. | |||
|- | |- | ||
! | ! style="" |Styles | ||
| | | style="" |Style declarations for the CSS classes that are used in any of the template elements. You can [[Manual:Extension/PDFCreator/Standard styles|view the standard styles]] here. | ||
|- | |- | ||
! | ! style="" |Properties | ||
| | | style="" |Allows to control some aspects of the PDF output. The following properties are available (shown in default settings):<syntaxhighlight lang="json"> | ||
{ | |||
"embed-page-toc": true, | |||
"nsPrefix": true, | |||
"attachments": true, | |||
"suppress-links": false, | |||
"no-redirect": false, | |||
"coverBackground": "File:filename.jpg" | |||
} | |||
</syntaxhighlight> | |||
|- | |- | ||
!Description | ! style="" |Description | ||
| | | style="" |Internal notes for the usage of this template. The description has no effect on the template itself. | ||
|} | |} | ||
== | == Configuration == | ||
{{#dpl:title=Manual:Extension/BlueSpiceConfigManager|include=#PDFCreator}} | |||
# | |||
== Customizations == | |||
== | |||
=== Semantic property === | === Semantic property === | ||
It is | It is possible to print a semantic property value in any template slot. The following example prints the value of the property "Revision_ID" of a page in the PDF footer.<syntaxhighlight lang="text"> | ||
<div class="pdfcreator-runningfooterfix"> | <div class="pdfcreator-runningfooterfix"> | ||
{{#show:{{FULLPAGENAME}}|? | {{#show:{{FULLPAGENAME}}|?Revision_ID}} | ||
</div> | </div> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 155: | Line 245: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Related content droplets == | ||
The following content droplets are available: | |||
The following | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
! | ! style="" |Droplet name | ||
! | ! style="" |Comments | ||
|- | |- | ||
| | | style="" |Book PDF link | ||
| | | style="" |Inserts a link on the page to a book. Clicking the link immediately downloads the PDF. | ||
|- | |- | ||
| | | style="" |PDF link | ||
| | | style="" |Inserts a link on the page to the same or any other page. Clicking the link immediately downloads the page. | ||
|- | |- | ||
| | | style="" |PDF preview | ||
| | | style="" |Opens the PDF directly on a page in a PDF viewer. | ||
| | |||
|- | |- | ||
| | | style="" |Exclude content in PDF | ||
| | | style="" |Wraps content in the tags <code><nowiki><pdfexcludestart />...<pdfexcludeend /></nowiki></code>You can expand the excluded content by moving the tags in source edit mode to a different content location. | ||
|<nowiki> | |||
|- | |- | ||
| | | style="" |PDF page break | ||
| | | style="" |The inserted page break marker is visible both in editing and in view mode. To hide this visual marker in view mode, you can add the following declaration to MediaWiki:Common.css:<syntaxhighlight lang="css"> | ||
/*Hide PDF page break marker in view mode */ | |||
.bs-tag-pdfpagebreak {display:none} | |||
.bs-tag-pdfpagebreak.ve-ce-leafNode {display:block} | |||
</syntaxhighlight> | |||
|} | |} | ||
== | == Migrating existing cloud templates == | ||
[[Manual:Extension/PDFCreator/Migrating existing cloud templates|For information about migrating your existing cloud template, click here.]] | |||
[[ | |||
{{translation}} |
Latest revision as of 15:54, 7 May 2025
Exporting a page or a book
To print a page to PDF, click on the page-icon in the page tools. This opens the export dialog field.

Select the export settings.
- Mode:
- Page: Prints the page.
- Page with subpages: Prints the page and all its subpages. This option is only shown if the page has subpages.
- Page with linked pages: Prints the page and the pages that are linked directly from this page
- Template:
- StandardPDF: This prints the page or pages without a cover sheet (unless the template has been edited).
- StandardBookPDF: This adds a cover sheet to the PDF (unless the template has been edited).
By default, the template StandardPDF shows the wiki's logo (from the skin settings page). If there are no custom settings, the default BlueSpice logo is used.
Exporting media links
Media links (=links that point directly to the file on the server) will add an attachment to the exported PDF File. This is independent of the chosen export mode (Page, Page with linked pages).
Exporting pages with linked pages
When pages are exported with their linked pages, link types are processed as follows:
- Media links will add an attachment to the exported PDF File
- File links are clickable and forward to the corresponding file page
- Mentions are clickable and forward to the user page
Adding a new template
By default, the wiki provides two PDF templates:
- StandardPDF: Template without a cover page for the single-page export.
- StandardBookPDF: Template with a cover page for the book export.
Starting with BlueSpice 5.1, PDF templates can be created from the page Special:PDF templates.
Copy an existing template
To create a new PDF template:
- Go to the page Special:PDF_templates.
- Copy an existing template.
Copy a template - Enter a name for the new template.
- Click Copy.
Click Edit template to start customizing your template.

Select general template properties
- Select the page orientation and the general export properties (for example, whether to show the Table of Contents for each page or whether to include links to pages that are not exported in the PDF itself).
- Click Next.
Select the template elements
Select the checkboxes for each element you want to include in your template:
- Header: Page header for the template pages
- Footer: Page footer for the template pages
- Document preface: Cover page
- Document appendix: Additional page that is added at the end of the pdf. It is formatted like the content pages (with header and footer) and adds to the PDF page count.
Click Configure for each template element to design the layout.
Configure the header
The header elements can consist of a header image (usually your logo) and some text (which can be a combination of predefined parameters and your own text).

If you want to show an image that is different from your wiki logo, you can select "Use custom logo" and enter an existing image name or upload a new image.
By default, the wiki provides localization system messages for each footer section. Use system messages if you want to support the language settings of your users. For example, in an English wiki, the English system message for {{int:pdfcreator-pdf-disclaimer}}
can be changed on the page MediaWiki:pdfcreator-pdf-disclaimer
. the German language version on page MediaWiki:pdfcreator-pdf-disclaimer/de
.
Alternatively, you can simply type your own text if the PDF export does not have to consider user languages. Or leave the section blank if you don't want to print text.
Configure the document preface (PDF cover)
You can define the following elements on your cover page:
Background image:
- If a bookshelf image exists, the bookshelf image is used as cover image for the Book PDF export.
- If no bookshelf image exists, the default image defined in the Configuration Manager is used as cover image for the Book PDF export.
- If a custom image is defined in the PDF template, the custom image will be used for the Book PDF export.
If you do not want to use any background image on your PDF cover page, all three locations for defining a book image must be empty.
Properties
The following properties can be configured:
{
"embed-page-toc": true,
"nsPrefix": true,
"attachments": true,
"suppress-links": false,
"no-redirect": true,
"coverBackground": ""
}
Label | Name | Default value | Description |
---|---|---|---|
Show namespace prefix | nsPrefix | true | The namespace prefix of pages is not printed in the page titles. |
Show table of contents | embed-page-toc | true | Include the table of contents of each exported page. |
Ignore redirect | no-redirect | false | If links are redirecting to a different page, the target page is not included in the pdf. |
Allow attachments | attachments | true | If files are directly linked with syntax Media: , the files are also attached in the pdf.
|
Disable links in PDF | suppress-links | false | Replaces all links in the pdf with a span-element if they do not link to a target within the pdf. |
- | coverBackground | <File:filename.png> | This property is set programmatically when a custom cover background image is provided. |
PDF template slots
All templates are saved as subpages of MediaWiki:PDFCreator
.
There, you can see the syntax for the different template elements.
Template elements
Each template consists of the same elements (slots):
Template slot | Description |
---|---|
Header | The page header of each PDF page. The basic structure is:<div class="pdfcreator-runningheaderfix">
<table>
<tr>
<td>
<div class="pdfcreator-runningheader-logo">
{{{logo}}}
</div>
</td>
<td>
<h1 class="title">{{{title}}}</h1>
</td>
</tr>
</table>
</div>
Important!The class .pdfcreator-runningheaderfix is necessary to top-align the header on the page. It works in conjunction with the class-declaration in the "Styles" tab of the template. Both need to be modified together. |
Content | The content layout. The basic structure is:{{{content}}}
|
Footer | The page footer of each PDF page. The basic structure is:<div class="pdfcreator-runningfooterfix">
<table>
<tr>
<td>
<span>{{int:pdfcreator-pdf-disclaimer}}</span>
</td>
<td>
<span>{{int:pdfcreator-pdf-export-time}}:{{#time:d.m.Y|now}}</span>
</td>
<td>
<span>{{int:pdfcreator-pdf-param-currentpagenumber-label}} </span>{{{currentpagenumber}}}
<span> {{int:pdfcreator-pdf-param-totalpagescount-label}} </span>{{{totalpagescount}}}
</td>
</tr>
</table>
</div>
Important!The class .pdfcreator-runningfooterfix is necessary to top-align the header on the page. It works in conjunction with the class-declaration in the "Styles" tab of the template. Both need to be modified together. |
Document preface | The cover page. It is meant for the book export, but can also be used for a page export. The basic structure for a book cover page is:<div class="pdfcreator-intro">
<div class="pdfcreator-intro-title">{{{title}}}</div>
</div>
Important!The class .pdfcreator-intro is necessary to display the image for the {{{logo}}}-parameter. Without this class present in the template, the {{{logo}}}-parameter has no effect. |
Document appendix | The last page of the PDF export. It has no predefined basic structure. |
Styles | Style declarations for the CSS classes that are used in any of the template elements. You can view the standard styles here. |
Properties | Allows to control some aspects of the PDF output. The following properties are available (shown in default settings):{
"embed-page-toc": true,
"nsPrefix": true,
"attachments": true,
"suppress-links": false,
"no-redirect": false,
"coverBackground": "File:filename.jpg"
}
|
Description | Internal notes for the usage of this template. The description has no effect on the template itself. |
Configuration

- Default export template for pages: The default template is shown when users select an export template in "Page" mode. It is also used when clicking on the PDF link for the Content Droplet PDF Link .
- Default cover background image
Admins can also set a default cover background image. It is applied whenever the document preface of the template contains the standard "intro"-wrapper:
<div class="pdfcreator-intro">
....
</div>
Default image:
/app/bluespice/w/extensions/BlueSpiceBookshelf/data/common/images/bs-cover.png
Output:

The image path can be deleted. In this case, no image will be output by default.
Alternatively, an uploaded image file can be specified (without a namespace prefix), for example: industry.jpg

If a book has its own bookshelf-image, this will be generated in the PDF when exporting directly from the special page "Books".
Customizations
Semantic property
It is possible to print a semantic property value in any template slot. The following example prints the value of the property "Revision_ID" of a page in the PDF footer.
<div class="pdfcreator-runningfooterfix">
{{#show:{{FULLPAGENAME}}|?Revision_ID}}
</div>
In the Styles tab, add:
/* add a background color to the header and footer */
.pdfcreator-runningheaderfix, .pdfcreator-runningfooterfix {
background-color: #eee;
}
This adds a grey background color.
In the Styles tab, add:
/* remove the border from the header */
.pdfcreator-runningheaderfix > table {
border-bottom: none !important;
}
/* remove the border from the header */
.pdfcreator-runningfooterfix > table {
border-top: none !important;
}
Related content droplets
The following content droplets are available:
Droplet name | Comments |
---|---|
Book PDF link | Inserts a link on the page to a book. Clicking the link immediately downloads the PDF. |
PDF link | Inserts a link on the page to the same or any other page. Clicking the link immediately downloads the page. |
PDF preview | Opens the PDF directly on a page in a PDF viewer. |
Exclude content in PDF | Wraps content in the tags <pdfexcludestart />...<pdfexcludeend /> You can expand the excluded content by moving the tags in source edit mode to a different content location.
|
PDF page break | The inserted page break marker is visible both in editing and in view mode. To hide this visual marker in view mode, you can add the following declaration to MediaWiki:Common.css:/*Hide PDF page break marker in view mode */
.bs-tag-pdfpagebreak {display:none}
.bs-tag-pdfpagebreak.ve-ce-leafNode {display:block}
|
Migrating existing cloud templates
For information about migrating your existing cloud template, click here.