DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   How to set landscape orientation? (http://www.daniweb.com/forums/thread14877.html)

vivekgalatage Dec 1st, 2004 9:07 am
How to set landscape orientation?
 
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.

tgreer Dec 10th, 2004 1:34 pm
Re: How to set landscape orientation?
 
The CSS Print Profile specification may help:

http://www.w3.org/TR/2004/CR-css-pri...ion-properties

cscgal Dec 10th, 2004 2:17 pm
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.

tgreer Dec 10th, 2004 2:56 pm
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.

cscgal Dec 10th, 2004 3:47 pm
Re: How to set landscape orientation?
 
Oh I see what you're saying. Use JavaScript to load the print dialog box. Gotcha there ;)

tgreer Dec 10th, 2004 3:49 pm
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.

scandal_uk Jan 7th, 2005 4:18 am
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.

jasbrown Feb 14th, 2005 10:58 am
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>

greenbirdweb Mar 21st, 2005 5:51 pm
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. :sad:

gangireddy Apr 28th, 2005 5:35 pm
Re: How to set landscape orientation?
 
Hi vivekgalatage,
Did you find a way to do this?. thanks....


All times are GMT -4. The time now is 11:42 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC