would like to replace node contents with pdf under some conditions
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.