942,779 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Dec 1st, 2004
-1

How to set landscape orientation?

Expand Post »
Hi Guys,

I m writing one HTML page where i wanted the page orientation to be set to LANDSCAPE through Javascript or CSS. So when I click on Print button or anyways on the HTML page, the print window will pop-up so now in that orientation property should be set to LANDSCAPE.

So does anyone know how to accomplish this?

Thanks in advance.
Similar Threads
Reputation Points: 12
Solved Threads: 0
Newbie Poster
vivekgalatage is offline Offline
6 posts
since Aug 2004
Dec 10th, 2004
0

Re: How to set landscape orientation?

The CSS Print Profile specification may help:

http://www.w3.org/TR/2004/CR-css-pri...ion-properties
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Dec 10th, 2004
0

Re: How to set landscape orientation?

I'm confused how one can set the page orientation of a website. One can simply stretch a browser window to any shape and size they want and if relative values are used for tables and such, the text will stretch along with the window.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Dec 10th, 2004
0

Re: How to set landscape orientation?

Quote originally posted by cscgal ...
I'm confused how one can set the page orientation of a website. One can simply stretch a browser window to any shape and size they want and if relative values are used for tables and such, the text will stretch along with the window.

Dani,

You can apply CSS style rules to create a custom-sized print box. What you cannot do is force the Print Dialog box to default to landscape. CSS and/or JavaScript cannot reach into the system resources.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Dec 10th, 2004
0

Re: How to set landscape orientation?

Oh I see what you're saying. Use JavaScript to load the print dialog box. Gotcha there
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Dec 10th, 2004
0

Re: How to set landscape orientation?

No, not quite. The CSS specification allows you to set styles that come into play when the user Prints. So the site may display one way, but when you print, certain elements will be excluded, etc.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Jan 7th, 2005
0

Re: How to set landscape orientation?

The CSS for this is simple (just use class="landscape"):

<style type="text/css" media="print">

@page port {size: portrait;}
@page land {size: landscape;}

.portrait {page: port;}

.landscape {page: land;}

</style>

So there.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
scandal_uk is offline Offline
1 posts
since Jan 2005
Feb 14th, 2005
0

Re: How to set landscape orientation?

scandal_uk,

I am trying to test out your CSS code for Landscape Orientation but I cannot seem to be able to make it work. I have created a test page with the following code. What am I doing wrong?

<html>
<head>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css" media="print">
@page port {size: portrait;}
@page land {size: landscape;}
.portrait {page: port;}
.landscape {page: land;}
</style>

</head>

<body class="landscape">
<table width="95%" border="0" class="landscape">
<tr class="landscape">
<td class="landscape">1</td>
<td class="landscape">2</td>
<td class="landscape">3</td>
<td class="landscape">4</td>
<td class="landscape">5</td>
<td class="landscape">6</td>
<td class="landscape">7</td>
<td class="landscape">8</td>
<td class="landscape">9</td>
<td class="landscape">10</td>
<td class="landscape">11</td>
<td class="landscape">12</td>
<td class="landscape">13</td>
<td class="landscape">14</td>
<td class="landscape">15</td>
<td class="landscape">16</td>
<td class="landscape">17</td>
<td class="landscape">18</td>
</tr>
</table>
</body>
</html>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jasbrown is offline Offline
1 posts
since Feb 2005
Mar 21st, 2005
0

Re: How to set landscape orientation?

I have been attempting the same CSS implementation, but I read in a book today that Opera 6/7 is the only browser which supports the property which sets the orientation.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
greenbirdweb is offline Offline
1 posts
since Mar 2005
Apr 28th, 2005
0

Re: How to set landscape orientation?

Hi vivekgalatage,
Did you find a way to do this?. thanks....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gangireddy is offline Offline
1 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Can someone help me here.
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Right Align Option Element Text





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC