Setup:Installation Guide/Advanced/Maintenance scripts/CreatePDF: Difference between revisions

Redaktion (talk | contribs)
No edit summary
Redaktion (talk | contribs)
Replaced content with "{{Textbox|boxtype=warning|header=Review PDF export compatibility!|text=The PDF export script for BlueSpice 4 is different.|icon=yes}} __FORCETOC__"
Tags: Replaced Visual edit
Line 1: Line 1:
{{Textbox|boxtype=warning|header=Currently not available for BlueSpice 5!|text=This extension is no longer bundled. A replacement script is in planning.|icon=yes}}
{{Textbox|boxtype=warning|header=Review PDF export compatibility!|text=The [[en4:Setup:Installation_Guide/Advanced/Maintenance_scripts/export|PDF export script for BlueSpice 4]] is different.|icon=yes}}


== Running the script ==
The script to export wiki pages to PDF is executed from: <syntaxhighlight lang="text">
php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file=spec.json
</syntaxhighlight>The specification file <code>spec.json</code> can have the following content:<syntaxhighlight lang="text">
{
    "module": "pdf",
    "attachments": 1,
    "recursive": 1,
    "title": "MyPDF",
    "target": "localfilesystem",
    "target-file-name": "All.pdf",
    "target-file-path": "/path/to/target-file"
}
</syntaxhighlight>It is possible to export either a set of  wiki pages or a single book.
{| class="wikitable" style="width: 100%;"
|+Key/value pairs for the specification file
! style="width:200px;" |key
! style="width:200px;" |possible values
! style="" |module='''pdf'''
(exports a set of wiki pages)
! style="" |module='''bookpdf'''
(exports a single book)
|-
| style="width:200px;" |attachments
| style="width:200px;" |1
0
| colspan="2" style="" |0 = no attachments are included
1 = attachments (links to "media" files) are included
|-
| style="width:200px;" |recursive
| style="width:200px;" |1
0
| style="" |0 = no linked pages are included
1 = linked pages (one level deep) are included
| style="" |value '''has to be'''  "1" or the pdf contains no pages!
|-
| style="width:200px;" |title
| style="width:200px;" |string
| style="" |Title of the [[Setup:Installation Guide/Advanced/Maintenance scripts/export#Creating a page list for the export|wiki page that contains the list of pages to be exported]]. '''The pages need to be links.'''
| style="" |Title of the book page. Exporting multiple books requires running separate scripts for each book.
<code>"title":"Book:Mybookname"</code>
|-
| style="width:200px;" |target
| style="width:200px;" |localfilesystem
| colspan="2" style="" |The file is exported to a local file system
|-
| style="width:200px;" |target-file-name
| style="width:200px;" |
| colspan="2" style="" |Name of the exported PDF file
|-
| style="width:200px;" |target-file-path
| style="width:200px;" |
| colspan="2" style="" |Target file location
|}


== Creating a page list for the export ==
The export list is defined in the wiki page that is shown as the <code>title</code> in the json-file. (In the example above, this is the page <code>MyPDF</code> .)
The page <code>MyPDF</code> now needs to list all pages  that will be exported to PDF.
This list can be created with an [[SMW queries|SMW inline query]] (BlueSpice free) or with a [[Manual:Extension/DynamicPageList3|DPL3 list]] (BlueSpice free).
Example of an SMW query to create an export for all pages in the categories <code>Process</code> and <code>Work instruction</code>:
You would add the following to your <code>MyPDF</code> page in the wiki:<syntaxhighlight lang="text">
==All processes==
{{#ask:[[Process:+]]|format=ul|limit=99999}}
==All work instructions==
{{#ask:[[Work instruction:+]]|format=ul|limit=99999}}
</syntaxhighlight>The same list can be created with the following DPL3 syntax:<syntaxhighlight lang="text">
==All processes==
{{#dpl:category=Process}}
==All work instructions==
{{#dpl:category=Work instruction}}
</syntaxhighlight>
== Setting up a CronJob ==
To automate the export, the following CronJob is available:<syntaxhighlight lang="text">
php {MW_ROOT}/extensions/BlueSpiceUniversalExport/maintenance/export.php --specification-file={MW_ROOT}/extensions/BlueSpiceFoundation/data/spec.json
</syntaxhighlight>
__FORCETOC__
__FORCETOC__

Revision as of 07:47, 25 April 2025

Review PDF export compatibility!The PDF export script for BlueSpice 4 is different.





To submit feedback about this documentation, visit our community forum.