Solved

printing cutting off at right

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

746 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

9 Experts available now in Live!

Get 1:1 Help Now