Imagick wrongly converts the text of a pdf

1

I will be direct, I have a problem after installing imagick to convert pdf to jpg when I convert a pdf with text because it does not convert well, here is a sample of what happens:

The method I use to convert the pdf to image is as follows:

$objImgick = new Imagick();
                    $file = $data;
                    $path_name = pathinfo($file);
                    $directory = $path_name['filename'];
                    $bookpath = "paquete/$cliente/book/$directory/";
                    $objImgick->pingImage($file);
                    $numberpg = $objImgick->getNumberImages();
                    $html = "";
                    if (!file_exists($bookpath)){
                        mkdir($bookpath, 0755, true);
                    }
                    $valida ="SELECT index_path FROM bas_indice WHERE index_path = '$bookpath' AND uid = '$uid' AND book_name = '$libro' limit 1;";
                    $existe = pg_query($con,$valida);
                    $numrows = pg_num_rows($existe);
                    if($numrows==0){
                        for ($i=0; $i < $numberpg; $i++) {
                            if (!file_exists($bookpath."/$directory-$cliente-$i.jpg")){
                                $objImgick->setResolution(100,100);
                                $objImgick->readImage("{$file}[$i]");
                                $objImgick->setImageFormat('jpg');
                                $objImgick->setImageCompressionQuality(0);
                                $objImgick->borderImage('white',20,20);
                                $objImgick->writeImage($bookpath."/".$directory."-".$cliente."-".$i.'.jpg');
                                $objImgick->clear();
                                $objImgick->destroy();
                                $checkpoint = true;
                            }
                        }

The problem is that when it is a pdf with images everything works perfectly, if someone had any idea, it is worth mentioning that I have uninstalled and reinstalled it a lot of times and it does not work.

P.D. My operating system is ubuntu 18.04

    
asked by Ismael 03.08.2018 в 02:14
source

0 answers