Jump to content

Help:Printing

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by ThePlaz (talk | contribs) at 05:01, 2 July 2009 (→‎Technical: try to explain more). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In general, printing a Wikipedia page is as simple as selecting print from your web browser.

The MediaWiki software that Wikipedia runs on uses Cascading Style Sheets in order to specify the style and layout of the printable version of a page. In modern browsers, the print function of the browser should automatically use the rules in the style sheets when you print an article, therefore the print command of your web browser is normally all you normally need to use.

Certain page elements that are self-references within Wikipedia normally do not print; these include section edit links, navigation boxes, message boxes and metadata.

Printable version

The left toolbar includes a link to a printable version. This printable version is often misunderstood, as it is not a print preview. It does not show page numbers, headers and footers applied by your browser. For a proper print preview, use the one supplied by your browser.

It is not needed for any modern browser. These browsers recognize the "@media print" CSS styles sent on regular (ie non-printable view) MediaWiki pages. The special print rules (not printing interface elements, sidebars, etc) are applied automatically when the document goes to print or print preview. If you have Internet Explorer 7 or later, Firefox, Safari, Chrome or Opera, just hit print; disregurard "printable view".

However, older browsers, including Internet Explorer 5 and 6, do not automatically apply these special rules when you hit print in your browser. MediaWiki's printable version applies these special print rules as the only rules. Thus when you print, the rules are applied, and only content will appear. (Note that the print view does not apply @media print rules applied in user style sheets [see below]).

Linking

It is possible to include links to the printable version of a page. Such links should not be needed in articles, and the use elsewhere should consider the actual need and limitations.

The link to the printable page is of the format:

http://en.wikipedia.org/w/index.php?title=Help:Printable&printable=yes

A link to the printable version of a page can be can be created by using

{{fullurl:{{FULLPAGENAME}}|printable=yes}}

This can be implemented with template {{printable}}.

Technical

The print stylesheets are called by link elements on every MediaWiki page such as:

<link rel="stylesheet" href="/skins-1.5/common/commonPrint.css?207xx" type="text/css" media="print" />

Older browsers such as Internet Explorer 5 and 6 do not support <link media= "print">, thus they will ignore this statement and will not automatically apply the printing rules;[1] For these browsers, the printable version is useful. All MediaWiki's printable view does is apply the commonPrint.css as the primary stylesheet. This means it is used for both display and printing.

CSS

The base MediaWiki print style sheet is at http://en.wikipedia.org/skins-1.5/common/commonPrint.css. This style sheet can be edited only by the developers.

The Wikipedia specific print style sheet is at MediaWiki:Print.css. This style sheet can supplement and override the base; it can be edited by admins.

Classes

MediaWiki:Print.css defines certain classes that are non-printable, specifically navbox, infobox.sisterproject, editlink, noprint, metadata, dablink. For example: since {{navbox}} uses the navbox class, any elements based on it will not print.

@media print

CSS media types define the rules for different types of presentation media. The normal display uses @media screen rules; printing rules can be defined with defined @media print

Controlling print

Elements

When creating a new element that should not print, the noprint class can be applied; for example:

<span class="noprint">foo</span>

Here, the content foo would display, but not print.

Personal customization

Readers with accounts can modify their monobook.css to customize their individual printing experience. Remember that rules using @media print will show— or not show if that is the intent —in print preview but not printable version.


Print URLs for references in citation templates
/* print URLs for references */
#content cite a.external.text:after {display: inline;}
  • Note: URLs will always print for references that do not use citation templates


Do not print references
/* do not print references */
@media print {
    ol.references, a.references-small {display: none;}
}


Change the print font size
/* save ink and paper with very small fonts */
@media print {
    #footer,
    #content,
    body { font-size: 8pt !important; }
    h1 { font-size: 17pt }
    h2 { font-size: 14pt }
    h3 { font-size: 11pt }
    h4 { font-size: 9pt }
    h5 { font-size: 8pt }
    h6 {
        font-size: 8pt;
        font-weight: normal;
    }
}

Problems

Blank pages in Internet Explorer

When printing with Internet Explorer 7, some pages may be blank except for the header and footer; this can be seen in the browser print preview.[2] The style sheets have rules to adjust the line height for improved readability with superscript and subscript text, including references. IE apparently has problems with the line-height CSS property. This issue appears to be resolved in Internet Explorer 8.

Code to resolve this problem was added to MediaWiki:Common.js on May 12, 2009. It will take 31 days for the cache to propagate the change site wide; to force the update, browse to MediaWiki:Common.js and follow the instructions at the top of the page to bypass your browser cache.

Old fix

This is the old way to resolve this issue, now deprecated by the change to MediaWiki:Common.js.

  • Ensure you have an account and are logged in
  • Edit your monobook.css and add:
@media print {
sup, sub, p, .documentDescription { line-height: normal; }
}

See also

Notes

  1. ^ "Assigning external CSS > link". Retrieved 2009-04-09.
  2. ^ There is an ongoing discussion about adding this to the Wikipedia CSS at MediaWiki talk:Common.css#Printing issues with IE7. Even if this is resolved, it will take 31 days for the CSS cache to take effect.
  • "Media types". Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. World Wide Web Consortium (W3C). Retrieved 2009-04-08.