473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Forcing page size when printing

kvijayhari
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
7 3816
acoder
16,027 Expert Mod 8TB
Is there anything else on the page besides the content that you wish to print?
Sep 3 '07 #2
pbmods
5,821 Expert 4TB
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
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
Anyone there to reply please!!!!!!!!!!!
Sep 7 '07 #5
acoder
16,027 Expert Mod 8TB
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
5,821 Expert 4TB
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
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

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

Similar topics

0
by: Niyazi | last post by:
Hi all, This my aspx page first line of code. <%@ Page CodeBehind="index.aspx.vb" Language="vb" AutoEventWireup="false" Inherits="TB.index" %> Than inside head tag I have following script(s)...
9
by: Sean McKaharay | last post by:
Since no one can answer the following question: I have a issue. I need to create a command line application/or windows application that will take 2 parameters and will print to the default...
8
by: CJM | last post by:
What is the best way to force a page break when printing from a browser? A page in my application generates a series of tables which are usually less than will fit on a page of A4. Ideally I want...
6
by: J Ames | last post by:
I have an ASP.NET (VB) form that has two drop downs, a horizontal rule and a button. The button invokes a stored procedure and several tables are created on the page with data populated. I want...
2
by: winstontuck | last post by:
I have different web pages that I want to automatically default to either landscape or portrait when printing, depending on the page. Can this be done with javascript.
4
by: DeWittds | last post by:
I have asked before and got little responce, So I try and try again. The code below prints the data in the same place but does not advance the page. I can see the lblnumber change but print in...
1
by: Dave Cullen | last post by:
How do I force a new page when printing with PrintDocument? I put a vbFormFeed in there after my footer and it gets ignored. Thanks Dave
3
by: Kristijan Marin | last post by:
Hi, I need to print a report like document. So in report there are many articles and what I need when I get to the end, is to update page numbers on the second page where the Table of Content...
4
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've a document which i'm creating and printing. i want to print 2 copies: 1. regular A4 copy 2. 70% of A4 size (like in copy machine, where you can choose the size of copy). how can...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.