Printing a huge document I have a web page containing n pages of paged data, showing 20 records at a time. The front end has a link to another page that opens the same data, but without the paging and calls window.print on document.ready.

On my paged content view I have a link:

&lt;a href="printallthisstuff.php" target="blank"&gt;Print all items&lt;/a&gt;


In printallthisstuff.php I have:

$(document).ready(function(){
    window.print();
});


printaallthisstuff.php can be a very large document, taking several seconds to load. What would be a better way of doing this?
I'd suggest that you do:

&lt;a href="print_frame.html" target="blank"&gt;Print all items&lt;/a&gt;

where print_frame.html is a simple page that displays an animated loading gif, and contains js that makes an ajax call to printallthisstuff.php.  The success callback for that ajax call will then replace the body content (which currently displays loading.gif) with the html returned from printallthisstuff.php, and call print, as you are doing now.