Is it possible to convert pdf to png without using Imagick?

Asked

Viewed 149 times

0

I am generating a pdf document and wanted to convert it to png, but client hosting does not accept php extensions like Imagick, I searched a lot on the net but only find options that uses Imagick, anyone has any idea if it is possible to do without and how?

1 answer

0


Some hosts may have Imagemagick installed, even without the PHP extension. In these cases, you can invoke the program directly from the system through PHP’s "exec()":

<?php
$location   = "/usr/local/bin/convert"; // Localização do "convert" do imagick
$name       = "original.pdf"; 
$nameto     = "covertido.png";
$convert    = $location . " " . $name . " ".$nameto; // Comando
exec ($convert); // Executa o comando

echo "PDF convertido para PNG!!";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.