ilovepdf / ilovepdf-php

iLovePDF Rest Api - PHP Library (https://developer.ilovepdf.com)
147 stars 39 forks source link

This task can't be processed. Check why in the params. (Elements cannot be blank.) #35

Closed Orik22 closed 2 years ago

Orik22 commented 2 years ago

i use this code

<?php 
require_once("sources/ilovepdf/vendor/autoload.php");
use Ilovepdf\Ilovepdf;
use Ilovepdf\EditpdfTask;
use Ilovepdf\Editpdf\TextElement;
try { 
if(file_exists('C:/xampp/htdocs/websites/site1/1.pdf')){
set_time_limit(0);  
chmod('C:/xampp/htdocs/websites/site1/1.pdf', 0755);
$PDF = new Ilovepdf('project_public_....','secret_key_...');
$editTask = $PDF->newTask('editpdf');
$editTask->addFile('C:/xampp/htdocs/websites/site1/1.pdf');
$textElem = new TextElement();
$textElem->setText("Sample text")->setCoordinates(300, 600)
            ->setPages(2)
            ->setTextAlign("center")
            ->setFontFamily("Times New Roman")
            ->setFontColor("#FB8B24") // Orange
            ->setBold();;
$editTask->addElement($textElem);
$editTask->setOutputFilename('pdfa1');
$editTask->execute();
$editTask->download('sources/pdf_folder/');
}
}
 catch (\Exception $e) {
   echo '<pre>';
   print_r($e);
   echo '</pre>';
}
?>

and get error "This task can't be processed. Check why in the params. (Elements cannot be blank.)" in params display this : ``` "[params:Ilovepdf\Exceptions\ExtendedException:private] => stdClass Object ( [elements] => Array ( [0] => Elements cannot be blank. )

    )"

anybody know why this can mean and how fix? pdf file is correct and have no problem
Orik22 commented 2 years ago

its fixed when i load manually from github all files to folder "src" , so why if i setup with composer i get not worked files?

mlpsouza2022 commented 1 year ago

Estou com o mesmo problema. Alguém encontrou a solução?

Orxan80dd commented 1 year ago

Estou com o mesmo problema. Alguém encontrou a solução?

eu carreguei do github todos os arquivos da pasta "src" e coloquei manualmente na pasta local, e tudo começou normalmente, eu não falo em espanhol então fui traduzir no google, desculpe se algo estiver errado

mlpsouza2022 commented 1 year ago

I'm Brazilian, the last message was in Portuguese. I understood your message. Thanks. But I already did what you recommended and I'm still having error.

LovePdf.Model.Exception.ProcessingException: '{"error":{"type":"ProcessingError","message":"This task can't be processed. Check why in the params.","code":400,"param":[{"server_filename":"176e16b3cbe49002eacc0e10eec7b10352a50985ecd6ab3e32b58b962e2230af.docx","filename":"Novo - Copia (2).docx","error":"DamagedFile"}]}}'