title: How to set the javascript function for print into landscape?
body: <p>I was trying to set the print orientation into landscape through javascript. I'm only just using the window.print() function for the page's content to be printed.
  here's the code:</p>
  
  <pre><code>&lt;a href="" onClick="window.print();return false"&gt;
  &lt;img src="images/print.png"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>With this I was able to print a sample page. But only it was on portrait format. The client requires it to be in landscape. so I tried on many codes I found. here's the one am sure your most familiar with.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $("#printLandscape").on('click',function () {
  $('head').append('&lt;link href="printLandscape.css" title="printLandscape" rel="stylesheet" /&gt;');
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>since it wasn't a button that am using to call the print function but an image type with href, I tried to change the previous one with:</p>
  
  <pre><code>&lt;a href="" onClick="window.print();return false" id="printLandscape"&gt;
  &lt;img src="images/print.png"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>See the id="printLandscape", I tried that on to be able to call the javascript function declared above and make the page print into my desired format which is landscape. But when I tried to print, to see if it was working. The printed page still has the default/formal or portrait type.</p>
  
  <p>Is there something am missing? Or did I not declare the javascript properly especially the id on href for it not to work fine?</p>
  
  <p>S.O.S</p>