HighDots Forums  

Re: CSS and Print

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: CSS and Print in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Christoph Paeper
 
Posts: n/a

Default Re: CSS and Print - 10-18-2003 , 04:14 AM






*Benjamin* <benny_farrow (AT) hotmail (DOT) com>:
Quote:
I am trying to use HTML to display documents to a user,
Hey, I believe you're the first one ever to try this.

Quote:
but then also have it sent directly to the printer
Isn't that nice, just click the little Printer-Icon in your Browser and it
prints.

Quote:
and have it look similiar
The Printout to what?

Quote:
For some reason that I can't figure out, when I only have a single
page, IE when it goes to print (print preview included), will add a
second blank page, regardless of what I do.
Select to print only the first Page then; at least the second one is not
wasted with some useless Text.

Quote:
script language="JavaScript"
Javascript is off topic here and you've left out the type-Attribute.

Quote:
var pgs = document.all.stuff;
That's IE-specific. Well, some Browsers try to imitate IE's proprietary DOM.
However, you're lying in the language-Attribute above, it's not JavaScript,
but JScript.

function getElementsByClassName(className) {
var allObj, retObj = new Array(), j=0;
allObj = document.getElementsByTagName ? document.getElementsByTagName("*")
: document.all ? document.all : 0;
if(allObj!=0)
for(i=0; i<allObj.length; i++)
if(allObj[i].className==className)
retObj[j++]=allObj[i];
return retObj;
}
function adjustPrint(size, unit) {
var pgs = getElementsByClassName("page");
if (pgs!=0)
for (i=0; i<pgs.length; i++) {
pgs[i].style.height = size + unit;
pgs[i].style.top = i*size + unit;
}
}
function adjustPrintBefore() {adjustPrint(9.5, "in")}
function adjustPrintAfter() {adjustPrint(11, "in")}
window.onbeforeprint=adjustPrintBefore;
window.onafterprint=adjustPrintAfter;

Quote:
pgs[i].style.height = "9.5in";
Wait a Moment ... that's 241.3 mm, should fit on an A4-Page with 297 mm - 2
· 20 mm Margin.

Quote:
pgs[i].style.top = (pgs[i].number-1)*9.5 + 'in';
Why not "i*9.5"?

Quote:
pgs[i].style.height = "11in";
That's 279.4 mm and fits only with highly reduced Margins on a Sheet sized
A4.

Quote:
window.onbeforeprint=adjustPrint;
window.onafterprint=adjustPrintBack;
I don't fully get what this whole JS-Stuff shall be for, plus only IE
understands both these Events.

Quote:
div.page {
position: absolute;
clip: rect(0,8.5in,11in,0);
8.5 inch (215.9 mm) is broader than A4's 210 mm.

Quote:
margin: -0.75in;
page-break-after: always;
}
div.CA {
position: absolute;
border: none;
}

div id="stuff" class="page" number="1"
There's no Attribute 'number' in HTML.

Quote:
style="top:0in;left:0in;width:8.5in;height:11in;"

Inline Styles are bad and make Code unreadable.

Quote:
div class="CA"
style="top:4.729in;left:.76in;width:6.948in;height :.563in;overflow:hidden;"
Some Text at a specified location.</div></div

div id="stuff2" class="page" number="2"
You use the same ID a second Time, which is not allowed and against the
Intention behind ID.

So why do you try to rebuild something with JScript and CSS, that your
Browser already can do? That Approach can only add new Problems, like with
I18N or Browser-Independency. If that Code shall only work on your Computer
or Computers controlled by you, you should have said so, because this is
comp.infosystems._*www*_.authoring.stylesheets.

Yes, I know that I didn't answer your question.

--
A magician pulls rabbits out of hats.
An experimental psychologist pulls habits out of rats.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.