Print page without opening it.

IS there a way to print a webpage without opening it?  Lets say I'm on a page: and that page is very stylized (CSS) and I have an option on that page to "Print Page"  BUT, I have another version of that page; and this page has been formatted to print out.

I DON'T want to open this page, I want to print it from

Is that possible? Any clues?
Who is Participating?
Big MontyConnect With a Mentor Senior Web Developer / CEO of Commented:
you may be able to do it with ajax and jquery:

the last one, you should be able to load the data into a variable (or hidden div) via ajax, and then use the printElement() call.

Dave BaldwinFixer of ProblemsCommented:
The only file that I know of that you can print without 'opening' it is a plain text file going to a plain text printer (which you probably haven't seen in 10 years anyway).  Everything else, HTML, PDF, 'doc', 'xls' must be opened by the program that can format it properly.  In the case of PHP, you can't even generate the page without opening it in PHP.  Until you open it and run the PHP, the 'printable' version doesn't even exist.
rgranlundAuthor Commented:

I'm using a JQuery Plugin and the following:
            $(document).ready(function() {

<span class="print">PRINT</span>

Open in new window

Is there a way to print a containing DIV instead of the entire page?
Dave BaldwinFixer of ProblemsCommented:
Is there a way to print a containing DIV instead of the entire page?
There might be but that's not your original question.  And in the case of the DIV, it still has to be on the page in the browser to print it with the correct formatting.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.