<a  href="javascript:void(1)" onclick="print_details(<?php print $item->nid;?>)"> Print Details </a>

// javascript function

function print_details(item_id){

var url = '<?php print get_base_url();?>/item/print-details/'+item_id;

window.open(url,'printdetails','height=768,width=1024,scrollbars=yes');
}

in hook_menu

$items['item/print-details/%'] = array(
'page callback' => 'print_item_details',
'page arguments' => array(2),
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);

function print_item_details($item_id){

// add css

<div id="print_button">
<input type="submit" name="print" value="Print this page" onClick="javascript:print();"/>
</div>

//content to print

}

Advertisements