Click to See Complete Forum and Search --> : Force 'Landscape' print mode
launchpad67a
11-16-2006, 11:11 PM
I have searched and searched but haven't found a working solution for this.
I am dynamically filling a wide table with data from mysql and would like to force the users printer to print the page in Landscape mode.
I have seen some methods using css but none seem to really work. Would anyone have any suggestions for this difficult problem?
Thanks,
Mike
I'm not aware of any type of scripting that can override the default. The user would have to change their browser's print settings for that.
launchpad67a
11-17-2006, 08:19 AM
Hi KDLA,
It is possible although probably not across all browsers. I was thinking some css like this in it's own style sheet and then encase the whole page in div tags.
<style type="text/css" media="print">
div.page {
writing-mode: tb-rl;
height: 80%;
margin: 10% 0%;
}
</style>
I haven't tested this yet but it just might work, at least in IE.
I believe that is an IE-specific style, proprietary only to Microsoft....
TheBearMay
11-17-2006, 08:46 AM
Could also look at specifying it this way:
<style type="text/css">
@media print {
div.page{
writing-mode: tb-rl;
height: 80%;
margin: 10% 0%;
}
}
@media screen {
....
}
</style>
You might look at this (http://www.devx.com/tips/Tip/32962).
launchpad67a
11-17-2006, 10:24 AM
Actually, this works to some degree. But the results vary greatly.
<style type="text/css" media="print">
div.page {
writing-mode: tb-rl;
height: 80%;
margin: 10% 0%;
}
@media screen {
....
}
</style>
My problem is, this is a php page with a dynamically generated table, with 16 columns that all get populated by mysql data. I can get most of the page to go into Landscape mode but the dynamic table doesn't want to do it.
I will try your suggestion Leeu.
Thanks