473,480 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

specifying page setup for printing

7 New Member
Hi,

I'm having a page in which table get dynamically generated. It can have any number of columns at run-time. I have a print button to print it, its working fine till now what I want is to set page orientation and margins depending on the number of columns like if columns are more than 12 than page orientation should be Landscape else Portrait and according to that setting margins of the page.

Is it possible?
It'll be really a good help.

Thanks in advanced.
Dec 15 '09 #1
8 5947
semomaniz
210 Recognized Expert New Member
as far as i know you can use javascript to print the current page but i am not sure there is a way to change the page setup using javascript. You can always use different css style sheets to have the print out look better but again having to many columns might be a problem.
Dec 15 '09 #2
Frinavale
9,735 Recognized Expert Moderator Expert
There is a way to specify the page. You use CSS to do this.
It's actually pretty cool. You make one CSS style sheet to use to display your content in the web browser, and then you make another CSS style sheet to specify how your content should look when it's printed. You use the media type to specify what the style sheet is used for. When you create a print style sheet you can hide things like buttons and images....you can completely change the way it looks if you need to.

Check it out:

-Frinny
Dec 15 '09 #3
semomaniz
210 Recognized Expert New Member
@ Frinny -- not that i am questioning you but is there a way to change the page setup to Landscape or Portrait using a script? I am aware that we can use css to change the format of the displayed data to print but i have never been able to change the page setup. If there is a way i will be certainly learning something new :-)
Dec 15 '09 #4
Frinavale
9,735 Recognized Expert Moderator Expert
I haven't done it myself but you can specify that the page should be printed as portrait or landscape.

According to the W3C: CSS Print Profile you can use the size property to specify which way the page should be printed.

You don't need to use a script for this (well you could use a little bit of script... the JavaScript print() function is really helpful if you want to provide print functionality to the page). But if the user just uses the browser menu and selects Print the CSS page will be used. The print CSS style will always be used regardless of how the user prints the page.

-Frinny
Dec 15 '09 #5
semomaniz
210 Recognized Expert New Member
i am gonna give it a try after work for sure. coz i struggled printing reports so i ended up creating pdf files, this will certainly ease my work if it works
Dec 15 '09 #6
Frinavale
9,735 Recognized Expert Moderator Expert
Let me know how it goes. Like I said, I've never used it myself but it looks like it should work.

-Frinny
Dec 15 '09 #7
Frinavale
9,735 Recognized Expert Moderator Expert
Did this work?

-Frinny
Jan 6 '10 #8
ally
7 New Member
Hi frinny,

I got busy in some other work. I just specified page margins through css. I didn't try specifying page setup and using size property. If I get time I'll surely try using it.

Thanks for your support :)
Jan 7 '10 #9

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

Similar topics

2
5356
by: Maileen | last post by:
Hi, I would like to modify IE page setup before printing the window. But i want to do it without opening the FILE-> Page Setup window... In fact, i would like to remove the header and footer...
4
5304
by: Patrick Beaudoin | last post by:
Hi, Is it possible to control the page setup (margins, header, footer, orientation, ...) without installing a new ActiveX. I found informations on TEMPLATEPRINTER but, if I understood well, the...
0
5636
by: amber | last post by:
Hi there, I'm having trouble with the page setup in a report I've created. Originally I copied an existing report (that was setup as landscape layout). On the new report, I changed the layout to...
2
1392
by: David Holmes | last post by:
Hi All I would ideally like to set the page setup values for my reports and have Access remember them in a run-time enviroment, but this doesn't seem to be possible. So how can I set the page...
1
4336
by: Andrew | last post by:
I'm adding this as it to me a while to figure out all the pieces to be able to do this without using Microsoft.Office.Interop which caused me problems on the web-server. Streaming is the easy...
2
2263
by: Christian | last post by:
Hi, I'm using the page setup dialog box as follows : Imports System.Drawing.Printing Public Class Form1 : Inherits System.Windows.Forms.Form Dim m_pageSettings As PageSettings Private...
5
1374
by: Dan | last post by:
Hi I have two identical machines with the same page setup margin settings on IE. However when i print preview a page the images are different on each machine, surely they should have the same...
1
12542
by: Tim Sprout | last post by:
I want to call Page Setup to set default printer and page size and orientation before batch printing pdf's silently from WebBrowser controls. I can print silently using DDE (the NDde library) or...
1
1976
by: Anita Yourhelp | last post by:
I'm trying to export an MS Access 2000 report to an .rtf file. In Access, default settings show page setup as letter sized. In word, my default settings show letter sized. However, when i export the...
0
6912
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6981
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5348
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,...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
565
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.