By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,309 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,309 IT Pros & Developers. It's quick & easy.

Forcing page size when printing

kvijayhari
P: 25
hi

i've doubt in the window.print() function.
I'm using a css with the attribute media=print and i'm hiding the unwanted things from display for printing using this css.

I'm opening a window which contains the content to be printed in a fixed size say 600x300 and i'm using the window.print() to print the current window content and it's printing the page to the default page setup (i.e the whole window) , but i wanted it to print to the specific size (i.e the current window size).. how can i make this?

May be i'm not explaining it well or may be explaining a bit more .. if u counldn't catch what i'm saying pls post with qs i'll post again.
but please help in this issue..
__________________
Sep 3 '07 #1
Share this Question
Share on Google+
7 Replies


acoder
Expert Mod 15k+
P: 16,027
Is there anything else on the page besides the content that you wish to print?
Sep 3 '07 #2

pbmods
Expert 5K+
P: 5,821
Heya, kvijayhari.

The print area is more or less determined by the User because of the Page Setup dialog.

You can set an absolute width and height for your body element, but this will not force pagination.

In the end, if you have multiple pages of content, you will need to either use PDF files or else accept that the User will be able to print it out using a height of 8.5".
Sep 3 '07 #3

kvijayhari
P: 25
Heya, kvijayhari.
You can set an absolute width and height for your body element, but this will not force pagination.

In the end, if you have multiple pages of content, you will need to either use PDF files or else accept that the User will be able to print it out using a height of 8.5".
I think i can try giving the width and height for the body element ..

I just have a single page content and it's like printing a short invoice or bill in a pre-formatted print sheets(i.e like pre-printed bills, books, cheques etc..)

That's why i asked ..

I use the javascript to open a separate window with the specified height and width and that page contains only the content to be printed not other than that.

then i javascript window.print to print that document.

Any way i'll try giving the body attributes and come back.
Sep 4 '07 #4

kvijayhari
P: 25
Anyone there to reply please!!!!!!!!!!!
Sep 7 '07 #5

acoder
Expert Mod 15k+
P: 16,027
Try to set the page size and margins using CSS @page rule. If you have any problems with the CSS, post in the HTML/CSS forum.
Sep 7 '07 #6

pbmods
Expert 5K+
P: 5,821
Heya, kvijayhari.

I'm going to go ahead and move this thread to the HTML/CSS forum, where our resident Experts will be better able to help you out.

Changed thread title to get a better reception over there.
Sep 7 '07 #7

kvijayhari
P: 25
Heya, kvijayhari.

I'm going to go ahead and move this thread to the HTML/CSS forum, where our resident Experts will be better able to help you out.

Changed thread title to get a better reception over there.
Thanks for moving ,,

Expecting to get done thru this forum.
Sep 11 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.