473,657 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3620
"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="printstyl e.css">

For details on how to write the stylesheet, you should ask in a CSS
group, e.g., comp.infosystem s.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/rasterTriangleD OM.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
7199
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 function that is called from a button. I think I can use a <div id="t"></div> for this ? Something like
3
1660
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 to print directly in landscape format. Is there any way to automate IE to change page payout to landscape automatically?
3
362
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 to print directly in landscape format. Is there any way to automate IE to change page payout to landscape automatically?
0
1238
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 able to change with a page's html code are (VIEW, LAYOUT, DEFAULT) and (VIEW, LAYOUT, DISPLAY) I have one page that displays a large scrollable image (satellite map image) with associated image map and would like to change to PPC IE default...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
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 we have to send another system
2
1615
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.