I wanted a means to print Drupal nodes in a fairly simple form: just the node title and body, no blocks, no search buttons, etc. I tried the Print Page module but that does not strip the peripherals. I tried the pdfview but that gave very crudely formatted results.
I knew that the book module had a 'printable page' option so I decided to look see how it did it and knock up a module myself. Here it is:
<?php
/*
* Add option to show printable page without embellishments.
*/
function printablepage_help($section = 'admin/help#printablepage') {
$output = "";
switch ($section) {
case 'admin/system/modules#description':
$output = t("Print page");
break;
}
return $output;
}
function printablepage_link($type, $node=0, $main) {
global $user;
$links = array();
if (($type == "system")) {
// URL, page title, func called for page content, weight, 1 = don't disp menu
menu("printablepage", t("Printable Page"), "printablepage_page", 1, MENU_HIDE);
}
$links[] = l(t("Printable Page"), "printablepage/$node->nid",
array("title" => t("Printable Page.")));
return $links;
}
function printablepage_page() {
/*
* In initial link nid is in the url
*/
$nid = arg(1);
$html = "<html><head><title>$node->title</title>";
$html .= "<base href=\"$base_url/\" />";
$html .= "<style type=\"text/css\">\n@import url(misc/print.css);\n</style>";
$html .= "</head><body>";
/*
* Search db for nodes.
*/
if( $nid != "term") {
$nodes = db_query("SELECT nid, title, teaser, created FROM {node} WHERE nid = %d", $nid);
} else {
$termID = arg(2);
$nodes = db_query("SELECT n.* FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid
WHERE t.tid = $termID ORDER BY n.nid");
}
while ($node = db_fetch_object($nodes)) {
/*
** Load the specified node:
*/
$item = node_load(array('nid' => $node->nid));
/*
* Add the title and the body to the output under construction.
*/
$html .= "<h1>$item->title</h1>\n";
$body = str_replace( '<!--break-->', '', $item->body);
$body = str_replace( 'h3', 'h4', $item->body);
$body = str_replace( 'h2', 'h3', $item->body);
$body = str_replace( 'h1', 'h2', $item->body);
/* Pass body through filters to create html */
$html .= check_output( $body);
$html .= "<hr/>";
}
$html .= "</body></html>";
print $html;
}
?>
Save as modules/printablepage.module, enable the module and enjoy.
This adds a 'Printable Page' like to every node display. Clicking the link shows the page without the Drupallish embellishments: headers, blocks, search boxes, footers, breadcrumbs etc, just the raw html, ready for print preview (something the 'Print Page' module lacked) and printing.
Not very sophisticated and probably breaking all known Drupal coding guidelines but it works for me with Drupal 4.4.0.
Update: the script now supports dumping all the nodes with a particular taxonomy term in order of node id which is approximately the same as chronological order. To use it, link to:
printablepage/term/<nid>
where <nid> is the node id, e.g. printablepage/term/15


Why not use a print stylesheet and just hide the stuff that way? It works in all browsers and doesn't waste a pageview.