window.print() not printing whole page

P

prabhjot singh

I've a scrollable screen and I'm having a print button on it and
"window.print()" function is called on its onclick event.

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).
 
M

Martin Honnen

prabhjot said:
I've a scrollable screen and I'm having a print button on it and
"window.print()" function is called on its onclick event.

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.
 
P

prabhjot singh

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..

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.
 
V

VK

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.
 
R

rf

prabhjot singh said:
I've a scrollable screen and I'm having a print button on it and
"window.print()" function is called on its onclick event.

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.
 
R

rf

VK said:
window.print() method prints the frame/window that currently is having
the focus.

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.
 
V

VK

rf said:
Geberish.

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.
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.
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
 
S

SAM

Le 10/22/09 12:09 PM, prabhjot singh a écrit :
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.


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; }
}
 
S

SAM

Le 10/22/09 3:37 PM, SAM a écrit :
Le 10/22/09 12:09 PM, prabhjot singh a écrit :

"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)
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top