PrintablePage

<< | Cookbook-V1 | >>

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Display a wiki page in a form suitable for printing.

Solution

Attach:printable-page.php - PHP code

Discussion

(printable-page.php is included in pmwiki releases)

The printable-page.php script adds a special "?action=print" option to wiki pages, which causes the page to be output in a form suitable for printing. WikiAdministrators will probably want to use this script as a guide for customizing their own printable page functionality.

The specific steps performed by this script are:

  • change the $PrintHeaderFmt and $PrintFooterFmt configuration variables to no longer contains links for editing pages or displaying page revisions
  • make links to other wiki pages go to the printable versions of those pages
  • modify the display of links to external sites to be in a form suitable for printing
  • include a GroupPrintHeader page if one exists, instead of a GroupHeader
  • include a GroupPrintFooter page if one exists, instead of a GroupFooter
  • open the printable version of the page in a new window

As a demonstration, ThisPage:?action=print will display the printable version of this page using the printable-page.php script given above.

The printable-page.php script is also useful for creating Development/WikiBooks -- PDF collections of wiki pages.

To use this script, simply add

    <?php include_once("scripts/printable-page.php"); ?>

to your local.php configuration. If you want to modify this script, it's a good idea to copy it into the local/ subdirectory and make modifications there, and then include_once("local/printable-page.php").

Revision History

Modified 29 July 2003 to set the text color to #000000, the font to Georgia, Times Roman or serif, and change <hr ... > to <hr ... />.

Modified 30 July to change $PageUrlFmt to $PageUrl.

1 September 2003: see PublishWikiTrail for a combination printable page and publish page script that uses a shared style sheet for improved output quality and consistency.

See Also

  • PmWiki.CustomHeadersAndFooters
  • PublishWikiTrail

Contributors

  • John Rankin

Make sure the $WikiTitle line in local.php precedes the reference to printable-page.php, otherwise your printable version will use the title from pmwiki.php
pmwiki-2.3.32 -- Last modified by {{}}?

from IP: 85.171.160.186 ip should be disabled by default for security reasons