Position the Print Dialog Box

I am trying to print a php page without seeing the page.  I have found a piece of script that will open up a div to be printed, however, it is positioned within <html> tags.

The Print Dialog box appears over the Html box.  Is there a way to position the Print Dialog box so that it is in the upper left hand corner of the screen always when it opens?
LVL 8
rgranlundAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
print a php page without seeing the page
I doubt that you can do this.  I think it's a function of the client browser.  And printing is something that should be under the client's control, 100%.  But if you can post a link to a web site that does what you want I'll be glad to try to show you how it works.

There might be some bizarro CSS thing you could do to hide the media=screen output except for a "print me" buttom.  The media=print CSS could allow the printed document to be visible.
0
rgranlundAuthor Commented:
Is there a way when you print a webpage,  for me to set it up that only certain parts of the page will print?  Like using a Media@print CSS???
0
Ray PaseurCommented:
Is there a way when you print a webpage,  for me to set it up that only certain parts of the page will print?  Like using a Media@print CSS???
Yes!
0
COBOLdinosaurCommented:
Any element that is set with display none will not pint.  So all you need to do with your print stylesheet is put a wrapper around all the content with display:none, and then for the element you want to print override with display:block or display:inline

Of course that will alter layout, so you may also need additional CSS to deal with positioning.

Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
<?php // RAY_temp_rgranlund.php
error_reporting(E_ALL);

// CREATE VARIABLES FOR OUR HTML
$printable = 'Hello World. ';
$unprinted = 'Goodbye Cruel World. ';

// CREATE OUR WEB PAGE IN HTML5 FORMAT
$htm = <<<HTML5
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow" />
<title>HTML5 Page in UTF-8 Encoding</title>

<style type="text/css" media="screen">
.printable { color:green; }
.noPrint   { color:orange; }
</style>

<style type="text/css" media="print">
.printable { color:blue; }
.noPrint   { color:transparent; }
</style>

</head>
<body>
<div class="printable">$printable</div>
<div class="noPrint">$unprinted</div>

</body>
</html>
HTML5;

// RENDER THE WEB PAGE
echo $htm;

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.