Cannot display converted PDF to image php
<p>I've got this page called pdf.php:</p>

<pre><code>&lt;?php

$im = new imagick( 'uploadedfiles/logo.pdf[0]' );

$im-&gt;setImageFormat( "png" );

header( "Content-Type: image/png" );
echo $im;

?&gt;
</code></pre>

<p>Then I've got script that echos this:</p>

<pre><code>$pdf_ext = '&lt;div class="aList" style="cursor:pointer; width:100%; clear:both; overflow:hidden; height:auto; margin-bottom:5px;" id="pdf.php"&gt;&lt;div style="float:left; margin:0 5px 0 0; padding:0 5px; width:auto;height:20px;border:2px solid black;"&gt;' . $ext . '&lt;/div&gt;' . $a_name . '&lt;/div&gt;';
</code></pre>

<p>This is what's displayed when I click on div.aList:</p>

<pre><code>&lt;div id="aPreview"&gt;&lt;img /&gt;&lt;/div&gt;
</code></pre>

<p>And in background jquery script after clicking on div.aList does this:</p>

<pre><code>// Element ID is send via $(".aList").live("click") event
function showPreview(elementId) {

    $("#aPreview img").attr('src',elementId);
    $("#aPreview").fadeIn('slow');

    $("body").click(function() {

        $("#aPreview").fadeOut('slow');

    });

}
</code></pre>

<p>But it doesn't show the image, what might be wrong?</p>
