My problem is it only prints the "viewable" part of the screen, not
the whole screen.If a page is scrollable, the print should extend to 2
(or more) pages if contents do not fit in 1 page. But in my case, it
always print only 1 page and rest of contents are not printed.
P.S. I'm using IE7 and it must work for IE7 atleast (for rest I'm not
bothered).
window.print() only pops up the print dialog and then the user can set
print settings in that dialog. So check the print settings in that dialog.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
Hey Martin,
Ok, but the same print button works fine, when I embed my jsp in a
parent jsp as iframe. But the problem is I can't go with that approach
due to standard being followed in our project. That is why I'm sure it
has nothing to do with 'Printer settings' atleast.
Just to describe, on the screen I've got a table which is scrollable.
and print button is below that scrollable area. And the print button
just prints the 1st page and leave other contents as is.
window.print() method prints the frame/window that currently is having
the focus. So one option is that the main window has the focus and
being printed with the visible part of table's iframe in it. Try this:
function printIt() {
yourTableIframe.focus();
yourTableIframe.print();
}
Another option - if the first didn't help - is that someone screwed
things up with media-dependent CSS. Check all involved pages if they
have something like <link href="..." media="print"> and if so then
what is in there.
Why? What is wrong with the browsers bult in print facility?
> My problem is it only prints the "viewable" part of the screen, not
> the whole screen.If a page is scrollable, the print should extend to 2
> (or more) pages if contents do not fit in 1 page. But in my case, it
> always print only 1 page and rest of contents are not printed.
Then your page is broken. What happens when you use the browsers built in
print facility?
You probably have <guess> scrollable divs </guess>.
URL? WIthout a URL any response you get will be only, as per above,
guesswork.
> P.S. I'm using IE7 and it must work for IE7 atleast (for rest I'm not
> bothered).
Sad.
This is, I suspect, an HTML problem and nothing to do with javascript.
Did the OP say anything about frames? No, not as far as I can see.
> So one option is that the main window has the focus and
> being printed with the visible part of table's iframe in it. Try this:
> function printIt() {
> yourTableIframe.focus();
> yourTableIframe.print();
> }
Geberish.
> Another option - if the first didn't help - is that someone
> screwed
Who? This is the OP's page. Who is this "someone" that has screwed with
his/her page?
> things up with media-dependent CSS. Check all involved pages if they
> have something like <link href="..." media="print"> and if so then
> what is in there.
As usual, more giberish.
My little boy, you are not in the position to talk with me like that,
try a year later after the regular posting in here - then we'll see.
So far it is tolerated from some pointed ears only but at least they
spell it right.
You so far get on some scripting basics, for instance on the
definition of the active window and the active document the
window.print applies to.
A little exercise sample could be like:
<!DOCTYPE html>
<html>
<head>
<title>window.print</title>
</head>
<body>
<p onclick="window.frames[0].focus();window.frames[0].print();">print</
p>
<iframe src="someLongDocumentCausingScroll.html"></iframe>
</body>
</html>
First print it using "print" script. Next print it over File>Print.
Compare results, think why are so different.
> > Another option - if the first didn't help - is that someone
> > screwed
>
> Who? This is the OP's page. Who is this "someone" that has screwed with
> his/her page?
It is not necessary to be OP made table to print, OP maybe only is
including it into the interface he has made.
> > things up with media-dependent CSS. Check all involved pages if they
> > have something like <link href="..." media="print"> and if so then
> > what is in there.
>
> As usual, more giberish.
Again - you are too green yet to get bold on me.
After having finished with the window.print exercise continue with CSS
media types:
http://www.w3.org/TR/CSS2/media.html#media-types
Make a print css with the rule overflow of the table (or this of its
container) set to none
something like :
@media print {
#table_container { overflow: none; }
}
--
sm
"a table wich is crollable" doesn't tell how that is made.
In fact, if I well understood, the table is in an iframe.
The VK's way seems to work (Firefox)
>> and print button is below that scrollable area. And the print button
>> just prints the 1st page and leave other contents as is.
>
>
> Make a print css with the rule overflow of the table (or this of its
> container) set to none
that applies only if the table is in a "scrollable" *DIV*
(not for an iframe, as I've seen that the table was there)
--
sm