title: Creating PDF from a single JPG file using Ghostscript - image placement issue inside PDF
body: <p>I'm trying to output a PDF file from a JPG file using Ghostscript. The following command works fine:</p>
  
  <pre><code>gs -sDEVICE=pdfwrite -sPAPERSIZE=a4 -o /pdf_from_image.pdf /path/to/viewjpeg.ps -c \(/source_image.jpg\) viewJPEG
  </code></pre>
  
  <p>Based on existing threads and Ghostscript documentation I'm using <code>-sPAPERSIZE=a4</code> to generate the output in A4 format. The PDF generates fine, but the PROBLEM is when the image dimensions don't match that of A4, GS puts the image at the bottom of the page with best "width" fit. I think it actually tries to put it in the lower left bottom. To add to it, at times the image is auto rotated.</p>
  
  <p>My question is:<br>
  1) Is there any option to put the image on top left corner of the page.<br>
  2) Stop GS auto rotating the image.</p>
  
  <p>Any help to put me in the right direction would be greatly appreciated. Thanks.</p>