无法将转换后的PDF显示为图像php

时间:2012-02-19 19:08:23

标签: php jquery

我的网页名为pdf.php:

<?php

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

$im->setImageFormat( "png" );

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

?>

然后我有脚本回复:

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

这是我点击div.aList:

时显示的内容
<div id="aPreview"><img /></div>

在单击div.aList后的后台jquery脚本中执行此操作:

// 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');

    });

}

但它没有显示图像,可能出现什么问题?

1 个答案:

答案 0 :(得分:0)

只需将imagick库安装到我的Mac上。