Jump to content

Template:Download PDF

From mediawiki.org
Template documentation

Use this template to make a button that, when clicked, will prompt the user to print or download a PDF with a specified set of pages.

See the installation instructions to get it working in your wiki.

Usage

[edit]
Markup Renders as
{{Download PDF
| pages = Help:Images, Help:Tables, Help:Templates
| text = Download help pages
}}
Download help pages

Installation

[edit]

To install this template in your wiki:

  1. Create a template with the following markup. You can choose the template name, parameter names and defaults to suit your wiki.
    <includeonly><span data-pages="{{{pages|{{FULLPAGENAME}}}}}" data-separator="{{{separator|,}}}" class="DownloadPDF cdx-button cdx-button--fake-button cdx-button--fake-button--enabled" tabindex="0" role="button">{{{text|Download PDF}}}</span>[[Category:Gadget:DownloadPDF]]</includeonly>
    
  2. Create MediaWiki:Gadget-DownloadPDF.js with the following code:
    /**
     * DownloadPDF enables printing or downloading a specified set of pages
     * Documentation: https://www.mediawiki.org/wiki/DownloadPDF
     * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-DownloadPDF.js
     */
    mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-DownloadPDF' );
    
  3. Add the following gadget to MediaWiki:Gadgets-definition:
    * DownloadPDF[ResourceLoader|hidden|default|categories=Gadget:DownloadPDF]|DownloadPDF.js
    

Done! Add your template to any page to verify that the installation was successful.

Template data

[edit]

Use this template to make a button that, when clicked, will prompt the user to print or download a PDF with a specified set of pages.

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Pagespages

Comma-separated list of pages to print or download

Default
The current page
Example
Help:Images, Help:Tables, Help:Templates
Stringoptional
Separatorseparator

Separator in the list of pages

Default
,
Example
;
Stringoptional
Texttext

Text of the button

Default
Download PDF
Example
Download instructions
Stringoptional

See also

[edit]