Solved

printing cutting off at right

Posted on 2004-10-16
4
164 Views
Last Modified: 2011-10-03
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
0
Comment
Question by:linque
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 500 total points
ID: 12330644
Hi linque,

You can try setting margins using CSS print:

Either:
<link rel="stylesheet" href="myprintingcss.css" type="text/css" media="print" />

or

<style type="text/css">
@media print {
   .mytext {color:red;}   /* Just an example. You'd probably set margins here for your stuff */
}
.mytext {color:blue;} /* Normally */
</style>

<span class="mytext">Hi!</span>

Regards,
Zyloch
0
 

Author Comment

by:linque
ID: 12330846
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?
0
 
LVL 10

Expert Comment

by:Havin_it
ID: 12331501
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.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12333208
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 ;)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question