Faire DomPDF que mon pdf writer pour phpWord

J'ai utilisé laravel pour mon application, et le dompdf est trouvé dans:

../vendor/dompdf/dompdf

Ce que je voulais obtenir est de convertir mon .fichier docx (Microsoft Word).fichier pdf. Le fichier docx a été généré par phpWord par le chargement d'un fichier de modèle et de remplacer les valeurs.

Voici l'extrait:

 //Get the absolute path of the template file
 $wordTemplatePath = $this->getDocumentTemplatePath('resignation.docx');

 //Load the template file
  $document = $this->phpWord->loadTemplate($wordTemplatePath);

//This will be filled with data
 $wordData = []

.... Process to fill the data .....

//Replace value to actual word document
  $this->setTemplateValues($wordData, $document);


//Generate its filename
  $file = $this->generateFileName('Retirement-Certificate.docx', $id);

        //Fetch the absolute path to save the document
        $filepath = $this->getSavePath($file);

        //Save the word document
        $document->saveAs( $filepath );

Après, une .docx fichier sera généré. J'ai voulu faire une version PDF de. donc, je recherche et trouve cet extrait de code, et ajouté dans mon code:

             \PhpOffice\PhpWord\Settings::setPdfRendererPath('../vendor/dompdf/dompdf');
\PhpOffice\PhpWord\Settings::setPdfRendererName('DOMPDF');

//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load($filepath); 

//Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save('result.pdf');  

Mais j'ai eu cette erreur:

    {"error":
{"type":"PhpOffice\\PhpWord\\Exception\\Exception","message":"PDF rendering library or library path has not been defined.",
"file":"C:\\xampp\\htdocs\\vagrant\\vendor\\phpoffice\\phpword\\src\\PhpWord\\Writer\\PDF.php",
"line":49}}

Comment pourrais-je faire DomPDF que mon pdf writer pour PHPWord? Je ne trouve pas d'autres options, donc je demande ici. J'espère que vous pourrez m'aider. Merci!

Avez-vous essayé un chemin d'accès absolu à la dompdf bibliothèque?

OriginalL'auteur Bajongskie | 2014-08-29