title: How to get DPI of a PDF file?
body: <p>Using ImageMagick or GhostScript or any PHP code how can I get the DPI value of PDF files?
  Here is the link for two demo files</p>
  
  <ul>
  <li><a href="http://jmp.sh/O5g5wL4" rel="nofollow noreferrer">http://jmp.sh/O5g5wL4</a>   -- of 72 DPI</li>
  <li><a href="http://jmp.sh/RxrnYrY" rel="nofollow noreferrer">http://jmp.sh/RxrnYrY</a>   -- of 300 DPI</li>
  </ul>
  
  <p>I have used</p>
  
  <pre class="lang-php prettyprint-override"><code>$image = new Imagick();
  $image-&gt;readImage('xyz.pdf');
  $resolutions = $image-&gt;getImageResolution();
  </code></pre>
  
  <p>It gives the same result for two different PDF files having different DPI. </p>
  
  <p>I have also used</p>
  
  <pre><code>pdfimages -list xyz.pdf
  </code></pre>
  
  <p>It gives a list of all information but how to fetch the DPI value from the list.</p>
  
  <p>How to get the exact DPI value of a PDF?</p>