title: PDF to JPG conversion using PHP
body: <p>I'm trying to convert PDF to IMG (JPG) with help PHP.</p>
  
  <p>I'm using imagick extension.</p>
  
  <p>this is my code</p>
  
  <pre><code>    $fp_pdf = fopen($pdf, 'rb');
  
      $img = new imagick(); // [0] can be used to set page number
      $img-&gt;readImageFile($fp_pdf);
      $img-&gt;setImageFormat( "jpg" );
      $img-&gt;setImageCompression(imagick::COMPRESSION_JPEG); 
      $img-&gt;setImageCompressionQuality(90); 
  
      $img-&gt;setResolution(300,300);
  
      $img-&gt;setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
  
      $data = $img-&gt;getImageBlob(); 
  </code></pre>
  
  <p>my source pdf file has right dimension (210x297 mm, like A4 has). And everything looks good. 
  But my jpg  has page dimension as 842x595 px, and DPI is 72.</p>
  
  <p>and img file much more smaller on paper then pdf, when i had print it.</p>
  
  <p>what is a proper way to make image file from pdf and make it so big as pdf (on paper)</p>