title: How to remove right and left margins from a PDF file using Ghostscript or any other command line tool?
body: <p>I've been trying several GS commands to remove the margins from right and left side of a PDF file such as:</p>
  
  <pre><code>gs \
    -q -dNOPAUSE -dBATCH \
    -sDEVICE=pdfwrite \
    -dSAFER \
    -dCompatibilityLevel=1.3 \
    -dPDFSETTINGS=/printer \
    -dSubsetFonts=true \
    -dEmbedAllFonts=true \
    -sPAPERSIZE=a4 \
    -sOutputFile=d:\\ghost\\gs\\bin\\shiftedgulf.pdf  \
    -c &lt;&lt;/BeginPage{0.9 0.9 scale 29.75 42.1 translate}&gt;&gt; setpagedevice \
    -f d:\\ghost\\gs\\bin\\gulf.pdf"
  </code></pre>
  
  <p>but its like nothing is happening, my question is there any effective, direct and clear way to achieve this ? </p>
  
  <p>Maybe this questions is duplicated but I tried most of the scripts and none of them is giving me any result, any other command line tool might be suggested is fine as well.</p>