By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,624 Members | 1,747 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,624 IT Pros & Developers. It's quick & easy.

How to set landscape orientation while printing through javascript

P: 17
Hi all,
Actually my requirement is that i need to print a page in landscape orientation , but i am unable to find solution for this through google.

So I tried to print the page by rotating the div by using the css
mydiv.style.filter='progid:DXImageTransform.Micros oft.BasicImage(rotation=3)'
It is working in IE but it's not working in Firefox

In firefox, images can be rotated by using <canvas> tag , so i can get if my div can be converted into an image on client side

Please help me in solving this ...

Thanks in advance
May 28 '08 #1
Share this Question
Share on Google+
5 Replies


gits
Expert Mod 5K+
P: 5,390
i'm not aware of any possibility to convert html-content to an image on clientside ...

kind regards
May 28 '08 #2

acoder
Expert Mod 15k+
P: 16,027
Yes, your best bet would be to use some server-side code to produce the image and return the src of the image via Ajax.
May 28 '08 #3

P: 17
Thanks for your replies ,

Using server side code for converting a div into a image makes my page slow ,
Is there any other way for achieving this on client side.

Do u have any ideas for using this
mydiv.style.filter='progid:DXImageTransform.Micros oft.BasicImage(rotation=3)'
in firefox.

Or any way for printing my page in landscape orientation

Thanks in advance
May 29 '08 #4

gits
Expert Mod 5K+
P: 5,390
since this is not standard there is currently no chance to get that working in FF. the best way would be to follow acoders advice or let the user decide the orientation in his/her print dialog ...

kind regards
May 29 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Using server side code for converting a div into a image makes my page slow ,
Which language are you using? Perhaps there are more efficient packages in the same or another language. Also, have you tried using Ajax?
Do u have any ideas for using this
mydiv.style.filter='progid:DXImageTransform.Micros oft.BasicImage(rotation=3)'
in firefox.
As gits said, this is non-standard - it's only supported in IE.

Or any way for printing my page in landscape orientation
There's no cross-browser way. You can get solutions for a specific browser in privileged/lower security settings. Perhaps it would be a better idea just to alert a message to the user to make sure that the landscape orientation option is selected.
May 29 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.