doulei8861 2016-12-05 12:29
浏览 118
已采纳

将PDF转换为具有相同分辨率的PNG

I am trying to convert a PDF to a PNG using ghostscript and Imagick.

I have tried this:

o_imagick = new imagick(mydocu.pdf[0]);
$this->o_imagick->setImageFormat('png');
file_put_contents ("actualpdf.png", $this->o_imagick);

Which generates and saves a new image but the resolution is weird. I need it to be the same resolution as the PDF. I assumed it would just generate an exact PNG copy out of the PDF.

Any ideas?

  • 写回答

1条回答 默认 最新

  • douyingmou1389 2016-12-06 12:12
    关注

    PDF doesn't have a resolution, generally, its a scalable vector format. So your requirement doesn't make sense.

    Its possible that the PDF contains an image, which can then have a resolution, but that's not quite the same thing.

    If you posted an example PDF file we might be able to make some suggestions, but as it is there is not sufficient information.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?