473,406 Members | 2,710 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,406 software developers and data experts.

Changing Page Layout

Hi all,

Is there a way to use javascript to change a web page's default layout
e.g. change page orientation to landscape or portrait when the user
prints a copy of the webpage?

Thanks,
June..

Jul 23 '05 #1
3 3602
"June Moore" <ju******@yahoo.com.au> writes:
Is there a way to use javascript to change a web page's default layout
e.g. change page orientation to landscape or portrait when the user
prints a copy of the webpage?


The user decides whether to print in landscape or portrait mode,
usually in the print dialog, so all you can do is to make the *layout*
of the printed page work better with landscape or portrait mode.

To do that, you use a print stylesheet. It is inserted as:

<link rel="stylesheet" type="text/css" media="print" href="printstyle.css">

For details on how to write the stylesheet, you should ask in a CSS
group, e.g., comp.infosystems.www.authoring.stylesheets.

There is no need for Javascript for having different layout between
print and screen, CSS does that already.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
Lasse Reichstein Nielsen wrote:
Is there a way to use javascript to change a web page's default layout
e.g. change page orientation to landscape or portrait when the user
prints a copy of the webpage?
The user decides whether to print in landscape or portrait mode,
usually in the print dialog, so all you can do is to make the *layout*
of the printed page work better with landscape or portrait mode.


While this is true in effect, you should also be able to suggest
printing options, CSS2 had the "identified page" thing (I think it's
dead now), and CSS3 has the paged media module, which should permit

<style type="text/css">
@media print {
@page {
size:landscape;
}
}
</style>
<p>Hello, World</p>

Since I don't have a printer here, I cannot check whether this works,
but I wouldn't be surprised if your beloved Opera took this into account:-)
Regards,
Yep.
Jul 23 '05 #3
On 15/07/2005 12:31, Yann-Erwan Perio wrote:

[snip]
<style type="text/css">
@media print {
@page {
size:landscape;
}
}
</style>
<p>Hello, World</p>

Since I don't have a printer here, I cannot check whether this works,
but I wouldn't be surprised if your beloved Opera took this into account:-)


As far as I know, Opera is the only browser (at least among the usual
set) that implements paged media correctly.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

55
by: Ton den Hartog | last post by:
Stupid basic question but I find it horribly imposible to find the answer elsewhere... :-( I want to have a piece of text in my HTML page and want to be able to change it in a Javascript...
3
by: NWx | last post by:
Hi, I have a web browser control integrated into a form, which display a HTM page I generate in my program And I want to be able to print that web page (it is a actually a report) But I want it...
3
by: NWx | last post by:
Hi, I have a web browser control integrated into a form, which display a HTM page I generate in my program And I want to be able to print that web page (it is a actually a report) But I want it...
0
by: beartrax | last post by:
I am using Windows Mobile 2003 SE and trying to change the menu selectable VIEW mode by using javascript or any other programming method within an html page. The menu view modes I would like to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.