Hi Every one,
I have a open window which contains the data from a jsp that needs to be printed. There are 2 things about the window
var win = window.open(url, name,
'width=' + width + ', height=' + height + ', ' +
'left=' + left + ', top=' + top + ', ' +
'location=no, menubar=no, ' +
'status=yes, toolbar=no, scrollbars=no, resizable=yes');
2) The content which is a huge list of data is available on the page with internal scroll bars using a css like this
As mentioned earlier the aim of this exercise is to print the window containing whole content currently when i just use
window.print(); it only prints the first few lines with internal scroll bars for the div. I changed "scrollbars=yes" in the open window
dynamically as this should only be for printing the window and not for display.
Of course, yeah, there are still documents which the browsers can't print right. Maybe seshu's document is one of those.
posted 7 years ago
Thanks for your fast reply Paul, i really appreciate it....as you mentioned that window.print() will only print what ever is there on the window at that movement is there a way we could dynamically change the window scroll bars and also css content before we call print() so that content prints out? Again any help will be appreciated.
seshu Palamanti wrote:Thanks for your fast reply Paul, i really appreciate it....as you mentioned that window.print() will only print what ever is there on the window at that movement is there a way we could dynamically change the window scroll bars and also css content before we call print() so that content prints out? Again any help will be appreciated.
I don't think you're quite following. My suggestion is to have two CSS stylesheets. One is the standard one which controls how data appears on the screen and the other one (declared with media="print") controls how data appears when printed. No "dynamically" (which as far as I can see is a code word for "some complex process which I don't understand") required.
Thanks again.....sorry if dynamic might have mis represented what I was trying to look for.. i get your idea here...of having two types of css one each for display and print.
posted 7 years ago
Thanks for all your help..by creating another css and overriding the classes as desired i was able to achieve what i was looking for. I added that link in the webpage and when window.print() was called this print css would be used and this would happen with out any further code.