I have a view that displays shipping details that you print and put on a box before shipping. But using Print module when you click the link it gives entire page to print with all the headers, footers and menus. I need only that block of text rendered by a view.

Also I couldn't make the Print module link appear in a view even though it claims it works, so I had to use View Footer Area and add some PHP to make link work.

<?php $current_url = getenv('REQUEST_URI'); ?>
<img src='/sites/all/modules/print/icons/print_icon.png'>
​<a href='/print<?php print $current_url; ?>'>Print</a>

But like I said it prints entire page and I need only view content.


2 Answers 2


I would look at this as most a front-end styling problem. Basically, you need to add print-only style rules that hide all the page elements you don't need. You can do this via an inline media query:

@media print {
  /* @TODO: Add other selectors that remove page elements
  header, footer, .my-custom-class, #my-custom-id {
    display: none;

Or a better, more portable, method is to just attach a custom print CSS stylesheet to whatever view that needs to be altered for printing:

drupal_add_css(drupal_get_path('theme', 'MYTHEME').'/css/print-page.css', array('media' => 'print'));

In addition to Shawn Conn's solution which is perfectly fine, you can add a separate page.tpl.php based on your path. You can define it your page preprocess function in template.php. Then in your tpl, display only page content. no other regions like header and footer etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.