Solved

printing cutting off at right

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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