# வார்ப்புரு:Pdf/doc



highlights that a link points to a PDF document (on some systems PDF files may take time to download and display within the browser, and their use on many websites is not compliant with the Web Content Accessibility Guidelines).  

## Usage
The following lines:  

yield:  

:  
:  
:  

**Note:** It was previously possible to add the icon with <code></code> by itself, but the functionality has changed, making this no longer work in Internet Explorer. You must surround it with the template as shown above to work correctly in Internet Explorer. See #Use in citation templates, below, for how to do this now without boogering IE.  

**Units**: Per WP:Manual of Style (dates and numbers), use KB and MB (kilobytes and megabytes), not KiB and MiB (kibibytes and mibibytes), as very few readers have ever even heard of the latter units.  

### PDFbot
An unassisted bot, User:PDFbot, has been created to add and keep file size information current. In addition, it will fix many mistakes and the limitation as described in the section below.  

Note: the bot will **replace** the contents of the second parameter when updating the file size.  

## Icon
The icon is added using CSS and is found in MediaWiki:Common.css, the relevant portion that applies the icon is:  
<source lang="css">  
/* Change the external link icon to an Adobe icon anywhere the PDFlink class  
is used (notably Template:PDFlink). This works in IE, unlike the above. */  
1. content span.PDFlink a,
1. mw_content span.PDFlink a {
background: url("http://upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif") no-repeat;  
padding-: ;  
}  
</source>  

## Limitations and easy workarounds
### The problematic "=" character
When this template is used with unnamed parameters, links containing the "<code>=</code>" (equals sign) character will cause the link to not display at all. Workarounds available are:  
- Use explicitly numbered parameters, and , for the URL and the file size, respectively
or  
- Use <code></code> as a replacement for <code>=</code>
or  
- Replace the <code>=</code> character with its numeric character entity reference, <code>&amp;#61;</code>

;Bad example:  

:  

;Good examples:  
<span>**&amp;#61;**</span>xy<span>**&amp;#124;**</span>Link.pdf Link to a PDF]|32&amp;nbsp;KB}}  
:  

**<span>1=</span>**<span>****</span>Link.pdf Link to a PDF]|**<span>2=</span>**32&amp;nbsp;KB}}  
:  

### Use in citation templates
This template is not instantly compatible with citation templates such as and , which put URLs in their own parameter, without markup. Two kinds of usage need two different workarounds, both using the invisible but existent "no-width space" numeric character entity reference, <code>&amp;#8203;</code>.  

;URLs ending in ".pdf" or ".PDF":  

The workaround is to not use an actual URL (and no [square brackets]) in the first parameter, but just the <code>&amp;#8203;</code> entity:  

renders as something like:  

:Some Article  

in the spaces that the parameters fill. (Exact spacing, punctuation, etc., depends on the specific citation template used). This prevents the appearance of a PDF icon auto-generated by MediaWiki being followed by one generated by .  

Doing this, however:  

would result in:  

:Some Article  

This trick needs to be done with the character entity, because leaving the first parameter blank will simply get the page categorized in a cleanup category for pages that misuse this template, and a bot will "fix" the page's use of the template (i.e., it will cause problems).  

;URLs not ending in ".pdf" or ".PDF":  

The workaround is to repeat the URL used in in inside as a square-backeted link, and use <code>&amp;#8203;</code> as the link text (note that numbered parameters are often required because of "<code>=<code>" characters in such URLs):  

yields:  

:Some Article  

I.e., it produces a PDF icon that links to the same target as the URL given in the citation template's parameter, without creating new link text, and meanwhile MediaWiki did not know this was a PDF file and so did not autogenerate a duplicative icon.  

fr:Modèle:pdf  
simple:Template:PDFlink  
</includeonly>