would like to replace node contents with pdf under some conditions I have been using hook_node_view to set the node contents depending on a bunch of things - this works well except when I need to replace the entire page with a pdf.
The hook function looks something like

function gcc_event_node_view($node, $build_mode = 'full') {
if ($node-&gt;type !== 'eventlist') {
    return;
}
if (have replacement html) {
    $node-&gt;content['body'][0]['#markup'] = "new stuff";
} else if (use pdf) {
    header('Content-type: application/pdf');
    header('Content-length: ' . filesize($fullPath));
    header('Content-Disposition: filename=' . $this-&gt;ShortName() . $file);
    readfile($fullPath);
   // need something here to make the node not render further at all
}


Appreciate all suggestions on the right way to do this.  Should be able to do images with image/jpg as well.
If you have to replace the entire page content, then you will have to alter the page.tpl.php conditionally, You can implement hook_preprocess_page for checking for node id or node type, Then modify the content printed in page.tpl.php.