Link to home
Start Free TrialLog in
Avatar of linque
linque

asked on

printing cutting off at right

Is there some way to determine how a page will print for my visitors?  I am working on a page that is cutting off some text at the right when printing.   I do know I can change margins, or revamp the entire site, but I have been looking at other sites and I see that they are similarly constructed yet are not having the same issue.  Perhaps (hoping) there is something I am overlooking.  Otherwise I'm faced with lots of white space on the right or a total site revamp
ASKER CERTIFIED SOLUTION
Avatar of Zyloch
Zyloch
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
Avatar of linque
linque

ASKER

Zyloch:

let's say I wanted the right margin to be 100pixels for printing purposes only.. would you mind showing me the syntax for that please?
Untested at this moment,  but you could try attaching this small script to a print button:

<script>
function myPrint()
  {
  document.body.margin-right='100px';
  window.print();
  document.body.margin-right='0px;
  }
</script>

Make your button like

<input type="button" onClick="myPrint();" value="Print this page"></input>

or

<a href="javascript:void(myPrint());">Print this page</a>

Don't have a printer at the moment so let me know if it worked.
I guess something like this:

Suppose you have a <div> that holds whatever you want printed, and let's say the <div> has an ID of "toPrint", then:

<style type="text/css">
@media print {
   div#toPrint {margin-right:100px;}
}
</style>

@Havin_it:

Not sure, but shouldn't it be document.body.style.marginRight? Not sure, but pretty sure the hypens aren't supposed to be there ;)