A Statistics Explained article can be printed as a PDF by using the print function at the top right of each page. The print function has been developed with optimal sizing and positioning of PNG images to automatically produce a correctly layouted document.
This tutorial includes special print tags for use should custom sizing and positioning of images be necessary, and for displaying or hiding additional text blocks or images that are suitable for either only a PDF version or only a web version.
Selectively displaying text in web version or PDF version
Via the tags noprint and onlyprint it is possible to have a selected part of an article only displayed in the web version and not in the PDF version for printing; or the opposite, only in the PDF version for printing and not in the web page view.
For example, an interactive map that has been used in the web version can be replaced in the PDF version by a static PNG image that should not be visible online.
- Text available in web version but not in PDF:
- <noprint></noprint>: content between tags is not converted into PDF
- Text available in PDF but not in web version:
- <onlyprint></onlyprint>: content between tags is converted into PDF but not displayed on the web page
Page layout
The additional tags pdfpagebreak and pdflinebreak are available to optimise the page layout in the PDF version:
<pdfpagebreak/> creates a page break in the PDF where it is added;
<pdflinebreak/> creates a hyphenation (splitting a word) in the word where it is added.
Positioning
Please note that positioning is automated for PDF versions; the following codes/tags only need to be used in exceptional cases
To position a specific image in a PDF it first has to be uniquely identified (tag <image></image> with parameter imgid) and then the location must be indicated at which it will be displayed in the PDF, in relation to the text (tag <imageput></imageput>):
- the image tag <image></image> encapsulates an image link of an article, to which parameters for identification and display can be added;
- with the image identification parameter imgid='image identifier' a unique name image identifier (e.g. figure1) is assigned to a particular image; it is recommended to use as name simply 'table1', 'figure2', 'map3' etc., in line with the caption below the image (nothing more is needed, because the name only has to be unique within a particular article and PDF generation);
- the image location tag <imageput></imageput> can then be used in combination with the imgid identifier to display this particular image at any chosen location within the generated PDF (possibly requiring some trial and error in the final layouting stage, see below); in wikitext this looks like <imageput imgid='image identifier'></imageput>, with the first part between < > specifying the 'beginning' of the location for table1, and the second one between </> the closing 'end' of this location. Note that no extra break tags or empty lines should be added before or after the line with this image location tag which in itself already a 'blank' line creating a new paragraph; this would result in extra empty lines in the page view, to be avoided.
Examples
- identifier (combined with other parameters, see further down):
- <image imgid='table1' zoom='80'>[[Image:ENPS_Youth_Population by age class.PNG|thumb|right|350px|Table 1: Population by age class (1 000 persons) - ''Source:'' for the EU-28, Eurostat {{Stable link|title=|code=demo_pjan}}; for the MED countries, Eurostat {{Stable link|title=|code=med_ps112}}]]</image>
- positioning:
- <imageput imgid='table1'></imageput>
Size and orientation
The size and the orientation of an image at a specific location in a PDF has been automated. However, it can be customised via another set of parameters (fullwidth, zoom, fullpage and rotation), to be inserted within the image tag, right after the identifier tag imgid, separated by a blank:
- fullwidth='on' displays the image at the maximum width, using the full width of the page (but without automatically rotating it, no auto rotation);
- zoom='n' ( 0 > n > 100 ) zooms the picture to n % of the page width (see example above, with display at 80 %);
- fullpage='on' displays the image on one full page, rotating it automatically if necessary to better fit the page;
- rotation='on' displays the image rotated by 90°.
Examples
- <image imgid='figure1' fullpage='on'> [[Image:Resource_productivity_2000-2007.jpg|thumb|right|350px|Figure 1: Resource productivity]]</image>
- displays Figure 1 on a full page in the PDF, non-rotated
- <image imgid='figure1' zoom='80'>[[Image:Resource_productivity_2000-2007.jpg|thumb|centre|700px|Figure 1: Resource productivity]]</image>
- displays Figure 1 with a size reduced to 80 %