Hi,

The window.print() dialog is not showing in Chrome (7.0.517.41). It appears fine in Firefox and IE 7 and 8.

I have tried running it (window.print()) from the Chrome console and that works. Perhaps there is a problem with "Drupal.behaviors.print = function(context) {window.print();}"?

I am using Drupal 6.19, and print 6.x-1.12.

Comments

peamik123’s picture

Version: 6.x-1.2 » 6.x-1.10

I've just run up against the same problem in my test site, also using version 6.x-1.12. However, I have a live site still using version 6.x-1.10 which is exhibiting the same fault, so it doesn't seem to be something introuduced in 6.x-1.11 or 6.x-1.12.

I'm using Chrome 7.0.517.44, but am unable to say whether this has been working in the past. It works fine in all other browsers.

I do get a tab open up when I click print, and the print page appears very very briefly - nowhere near long enough to be able to read anything - then it closes again. Clearly some processing is being triggered, but I have no idea how to track this further.

Has anyone else found a solution to this problem yet?

peamik123’s picture

Version: 6.x-1.10 » 6.x-1.12

More info has come to hand since my earlier post.

Copying the link from the print icon & running that in a new tab works fine. The print dialogue appears.

Running the window.open('http://www.example.com/print/node/2394'); within the firebug console on Chrome also fires up the new tab, but still closes it down again before the print dialogue can appear. No errors are reported in the console.

A more experienced colleague of mine has suggested that perhaps there is a timing problem occurring. Maybe the new window needs to wait a bit before trying window.print().

I am hoping that this info will give someone else some ideas of how to resolve this problem.

ReMMeR’s picture

Status: Active » Patch (to be ported)

Some delay fixes the problem.

Fixed with this hack :

print.pages.inc

line 219
change original

 $print['sendtoprinter'] = $print_html_sendtoprinter ? "<script type='text/javascript'>Drupal.behaviors.print = function(context) {window.print();$window_close}</script>" : '';

to

$print['sendtoprinter'] = $print_html_sendtoprinter ? "

Drupal.behaviors.print = functio n(context) {setTimeout(\"window.print();$window_close\",1000);}

" : '';

i added 1 second delay (setTimeout ) for print and Crome now works fine.

jcnventura’s picture

Status: Patch (to be ported) » Needs review
kristen pol’s picture

The print window is not showing up for me in Firefox or Chrome. I tried added the setTimeout code above but it still doesn't show up for me. I'm on Linux so have not tried IE yet.

If I change the <body> to <body onload="window.print()"> then the print dialog does show up. This is where it used to be until the patch was committed from #696318: <body onload="window.print();"> blocks Drupal.behaviors.* functions from triggering before print: http://drupal.org/node/696318

Kristen

jcnventura’s picture

The onload=window.print call will only show up when you configure that in admin/settings/print..

I've tested print + D6 + Chrome 9 + Ubuntu 10.10 and it worked fine for me.

jcnventura’s picture

Status: Needs review » Closed (cannot reproduce)

This seems to be a Chrome problem that was (as it should) be fixed in Chrome.

I'm unable to reproduce the problem as reported.

jcnventura’s picture

Status: Closed (cannot reproduce) » Closed (duplicate)

This problem has reappeared, and a fix will be applied to dev soon.

See #1579870: Window open + print + close, has some issues in non-Firefox browsers