How to set landscape orientation while printing through javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ramesh1210
    New Member
    • Jul 2007
    • 17

    How to set landscape orientation while printing through javascript

    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.fil ter='progid:DXI mageTransform.M icrosoft.BasicI mage(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
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    i'm not aware of any possibility to convert html-content to an image on clientside ...

    kind regards

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      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.

      Comment

      • ramesh1210
        New Member
        • Jul 2007
        • 17

        #4
        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.fil ter='progid:DXI mageTransform.M icros oft.BasicImage( rotation=3)'
        in firefox.

        Or any way for printing my page in landscape orientation

        Thanks in advance

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          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

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by ramesh1210
            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?
            Originally posted by ramesh1210
            Do u have any ideas for using this
            mydiv.style.fil ter='progid:DXI mageTransform.M icros oft.BasicImage( rotation=3)'
            in firefox.
            As gits said, this is non-standard - it's only supported in IE.

            Originally posted by ramesh1210
            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.

            Comment

            Working...