When the core page template is used to render a page then the print screen icon produces a print version of the page. However when its used with a custom template it doesnt work properly and I simply get a print of the menu and not the content. i presume a piece of code is missing from the template but please could you confirm what it is

Nick

Comments

tecjam’s picture

I have the same issue.
I use page templates for nodes:

eg: page--node.tpl.php

I also use a node template for each content type:

eg: node--entry.tpl.php

I have tried copying the print.tpl.php template into my theme directory, renaming it to

print--html--node--entry.tpl.php and all others filenames given in the readme.txt file.

It does not matter what I called it, it just isn't used at all.
My print page only outputs the Logo, Accessabilty Links and a few other lines, then the skeleton defined in the page--node.tpl.php file ... but no node content at all.
I use html comments in these templates, so I can clearly see which template is called, in this case the page--node.tpl.php.

The html.tpl.php file is not used and thus the print view doesn't even start with a html tag.

I had a look into the code:

function print_preprocess_node(&$variables) {}

and

function print_preprocess_print(&$variables) {

both of which define $variables['theme_hook_suggestions'], but I can't seem to see what it's doing.

When I rename or remove the page--node.tpl.php - it works, but of course that messes up my website as I have these for a reason.

How does one force it to use the print template, please?

saritha.peddapuli’s picture

Hi,

I used "print_insert_link()" function on custom template to display print icon.

print_insert_link(), print_mail_insert_link(), print_pdf_insert_link()

The *_insert_link functions are available to content developers that prefer
to place the printer-friendly link in a custom location. It is advisable to
disable the regular Printer-friendly link so that it is not shown in both
locations.

Calling the function like this:

print_insert_link()

will return the HTML for a link pointing to a Printer-friendly version of
the current page.

It is also possible to specify the link to the page yourself:

print_insert_link("print/42")

will return the HTML pointing to the printer-friendly version of node 42.

jcnventura’s picture

Status: Active » Fixed

Just fixed this in dev.. Please test it.

There was some interference between getting the normal preprocess_page variables and the theme_hook_suggestions which broke the print module templating.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nevosa’s picture

Having the same issue here:
updated to 7.x-1.x-dev, and still happens.
I get the skeleton and content is ignored. The template IS being called (can see my printouts) but the content is not printed.

Nevo

nevosa’s picture

Status: Closed (fixed) » Active
jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

@nevos: I can't reproduce this.. I get all my content and of course any customisation I put into the template.. Make sure you've flushed all the caches, as the theming layer may be reusing the old preprocess function definition.

If that doesn't fix it, can you please provide a copy of your custom template?

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

No further info in two weeks. Closing the issue again.

pichai’s picture

...And Don't forget update (Print) Display fields in your Content types.

Have a nice day
:-)

fdambrosio’s picture

Issue summary: View changes

we have te same problem.