Solved

printing cutting off at right

Posted on 2004-10-16
4
151 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now