Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

Print page without opening it.

IS there a way to print a webpage without opening it?  Lets say I'm on a page: www.MYSITE.com/report.php 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; www.MYSITE.com/report_print_version.php and this page has been formatted to print out.

I DON'T want to open this page, I want to print it from www.MYSITE.com/report.php.

Is that possible? Any clues?
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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.
Avatar of Robert Granlund

ASKER

@Dave

I'm using a JQuery Plugin and the following:
        <script>
            $(document).ready(function() {
                $('span.print').printPage();
            });
        </script>

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

Open in new window


Is there a way to print a containing DIV instead of the entire page?
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.