Jump to content

Template:Download PDF

From mediawiki.org
(Redirected from DownloadPDF)
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.

This template is a template gadget that requires the DownloadPDF gadget to work. Follow 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 any name and the following markup (you can adjust the parameter names and defaults to suit your wiki):
    <span data-pages="{{{pages|{{FULLPAGENAME}}}}}" data-separator="{{{separator|,}}}" class="DownloadPDF cdx-button cdx-button--fake-button cdx-button--fake-button--enabled">{{{text|Download PDF}}}</span>[[Category:DownloadPDF.js]]
    
  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=DownloadPDF.js]|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]