title: How do I print a PDF file to a printer in landscape from Python?
body: <p>I'm using Mac OSX but I need a platform independent method to print a pdf file.
  I created a graph in Matplotlib and want to print it to my printer. </p>
  
  <p>I can set the orientation of the canvas to fit a portrait layout with:</p>
  
  <pre><code>fig.set_size_inches(  8.27,11.69) # set the figure size in inches
  </code></pre>
  
  <p>but using:</p>
  
  <pre><code>fig.set_size_inches( 11.69, 8.27) 
  </code></pre>
  
  <p>prints a cropped portrait oriented figure</p>
  
  <p>I found this on another post here:</p>
  
  <pre><code>import subprocess
  import shlex
  
  printfile='test.pdf'
  fig.savefig(printfile)
  proc=subprocess.Popen(shlex.split('lpr {f}'.format(f=printfile)))
  </code></pre>
  
  <p>Can anyone help me with the format of the code to set the print orientation to landscape?</p>