Release status: beta
|Description||Provides access to the Electron Service for browser based PDF rendering|
|Author(s)||Wikimedia Germany (WMDE) – Roadmap|
|Latest version||continuous updates|
|Compatibility policy||release branches|
|License||GNU General Public License 2.0 or later|
Translate the ElectronPdfService extension if it is available at translatewiki.net
|Check usage and version matrix.|
|Open tasks · Report a bug|
The ElectronPdfService extension provides access to the Electron Service for browser-based PDF rendering. (The Electron Service needs to be installed separately.)
The extension provides a handy way to access the Electron Service via a RESTBase API endpoint. The Electron Service provides a new rendering method for Wiki-pages as alternative to the existing OCG/LaTeX rendering. The huge advantage of using the Electron Service is, that the generated PDF will contain all tables as well as rendered infoboxes and other templates which was not possible with the old method. Read more on the background of the motivation for the extension and the service.
And here's an example: PDF for the article about Berlin.
- Install and configure an Electron Service exposed over a RESTBase API endpoint
- Follow the service install instructions & verify correct functioning with http://yourhost:port/pdf?accessKey=yourkey&url=https://de.wikipedia.org/wiki/Berlin
- Install https://github.com/wikimedia/restbase, and set up a config similar to config.example.wikimedia.yaml. Adjust the pdf server URL to reflect your host & port.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'ElectronPdfService' ); $wgElectronPdfServiceRESTbaseURL = '/api/rest_v1/page/pdf/';
- Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Ubuntu 16.04.3 (Local Install)
When installing on Ubuntu Server 16.04.3 LTS, the following configuration was needed instead:
$wgElectronPdfServiceRESTbaseURL = "http://HOSTFQDN:3000/pdf?accessKey=secret&url=http://HOSTFQDN/wiki/";
/wiki/ is the Apache rewrite URL as this installation mimics the generic variation of re-writing. Change to whatever you use! Yes, hardcoding can be bad, but variables refused to work otherwise.
- Once the extension is installed, the "Download as PDF" link in the MediaWiki sidebar will lead you to a new selection screen.
- On the selection screen you can then choose whether you want to render your PDF using Electron ("Single Column") or using the old OCG/LaTeX renderer ("Two Column").
- After you've chosen the desired rendering method, click the "Download" button to get the PDF.
- Note: if there is no alternative rendering method available on the Wiki, "Download as PDF" will immediately serve you the Electron rendered PDF without showing a selection screen.
|This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page.|