Review PDF export compatibility!
The PDF export script for BlueSpice 4 is different.
PDF Export from CLI
You can export PDF files from your MediaWiki installation via the command line by using a specification file in JSON format.
Create a JSON Specification File
This file defines all the parameters for the export process.
Export specification for a single page:
{
"module": "batch",
"target": "filesystem",
"params": {
"user": "WikiSysop",
"title": "Test export",
"filesystem-path": "/tmp",
"filename": "Test.pdf",
"template": "StandardPDF"
},
"options": {
"attachments" : true,
"embed-page-toc": true,
"title-show-namespace": true
},
"pages": [
{
"type": "page",
"target": "ABC:Page_1/Subpage1",
"label": "Subpage1",
"rev-id": "1234"
}
]
}
Export specification example for mode pageWithLinkedPages or pageWithSubpages
{
"module": "batch",
"target": "filesystem",
"template": "StandardPDF",
"params": {
"mode": "pageWithLinkedPages",
"user": "WikiSysop",
"title": "Test export",
"filesystem-path": "/tmp",
"filename": "Test.pdf",
"relevantTitle": "Main_Page"
},
"options": {
"debug": true,
"attachments" : true,
"embed-page-toc": true,
"title-show-namespace": true
}
}
Start Export from CLI
Once your JSON file is ready, run the following command to start the export:
php extensions/PDFCreator/maintenance/CreatePDF.php cache/specification.json
Available Parameters
General parameters (params):
mode:pageWithLinkedPages: The pages linked on the page are exported as well.pageWithSubpages: The subpages of the page are exported as well.Important:
"mode" does not work with module "book"!
filename: name of the exported PDFfilesystem-path: path to store the exported filetarget: can befilesystemordownloaduser: username used for export contexttitle: optional title for the PDFtemplate: optional PDF template
Options (options):
attachments:trueto include linked filesembed-page-toc:trueto include the page table of contentstitle-show-namespace:trueto avoid following redirects
Page definitions (pages):
type: one ofpage,raw- page: wiki content page
- raw: requires setting of label, rendered as <h1>-tag, mainly used for a special book export
label: replaces actual page titletarget: page namerev-id:export of a specific revision ID of the page instead of the latest revision
Automating with CronJob
To automate regular exports, set up a CronJob:
php {MW_ROOT}/extensions/PDFCreator/maintenance/CreatePDF.php --specification-file={MW_ROOT}/extensions/BlueSpiceFoundation/data/spec.json
Replace {MW_ROOT} with your MediaWiki installation path.