0

I like this Printer module on my Drupal 7 site. But, when it generates PDF, it contained breadcrumb and no page-count on the footer. Is there a way to add name of "Content type" and node "Title", instead of breadcrumb? I also would like to have the page-count number on the footer on every page. Is there a file that I can modify?

PS: I'm using mPDF third-party tool

2

The Print module uses a separate template for the print, email, and PDF versions of a page. You would need to implement a hook_preprocess_print() to set up some addtional variables, and then duplicate print.tpl.php into your theme and use your new variables (and/or change the markup in the template). The default template file is rather well documented, and explains what is possible.

| improve this answer | |
  • That solves most of the issues. Any idea how can I print the page count on PDF? – CocoSkin Jul 23 '14 at 16:12
  • @H-L I am not sure if you can actually get this in PHP, at it will vary by the user's printer settings (page count will be different between paper sizes). But, it has been a few years since I have heavy work with this module. – mpdonadio Jul 23 '14 at 16:14
  • Any idea how can i print the name of content-type on print.tpl.php? the code <?php print $type; ?> does not work. – CocoSkin Jul 23 '14 at 17:40
  • @H-L You need to make a preprocess function in your theme, and then set $variables['type'] = $variables['node']->type. – mpdonadio Jul 23 '14 at 17:46
1

You can write CSS to hide the breadcrumb and other unwanted content to print.

@media print
{
.breadcrumb{display:none;}
}

Put other unwanted content class in @media print.

| improve this answer | |
  • what about adding name of content-type, node title and page count :) – CocoSkin Jul 23 '14 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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