phpgearbox / pdf

A PDF builder using HTML or DOCX templates.
MIT License
180 stars 112 forks source link

An uncaught Exception was encountered Type: RuntimeException #18

Open netizenking opened 7 years ago

netizenking commented 7 years ago

I am encountering the above error after executing this statement:

//$temp_file is the .docx file created by phpWord
//res is the name of the .docx file without the extension
Gears\Pdf::convert('C:\xampp\htdocs\yu\\'.$temp_filename, 'C:\xampp\htdocs\yu\\'.$res.'.pdf',
                [
                    'converter' => function()
                    {
                        return new Gears\Pdf\Docx\Converter\LibreOffice
                        ([
                            'binary' => 'C:\Program Files (x86)\LibreOffice 5\program\soffice.exe',
                            'output'=>'C:\xampp\htdocs\yu'                            
                        ]);
                    }
                ]);

My backtrace is as follows:

An uncaught Exception was encountered

Type: RuntimeException

Message: (null)

Filename: C:\xampp\htdocs\yu\vendor\gears\pdf\src\Pdf\Docx\Converter\LibreOffice.php

Line Number: 139

Backtrace:

File: C:\xampp\htdocs\yu\vendor\gears\pdf\src\Pdf\Docx\Backend.php
Line: 115
Function: convertDoc

File: C:\xampp\htdocs\yu\vendor\gears\pdf\src\Pdf.php
Line: 184
Function: generate

File: C:\xampp\htdocs\yu\vendor\gears\pdf\src\Pdf.php
Line: 168
Function: save

File: C:\xampp\htdocs\yu\application\controllers\Applications.php
Line: 255
Function: convert

File: C:\xampp\htdocs\yu\index.php
Line: 317
Function: require_once

When i var_dump $cmd in LibreOffice.php line 123 i get the following: string(212) "start /wait C:\Program Files (x86)\LibreOffice 5\program\soffice.exe --headless --convert-to pdf:writer_pdf_Export --outdir "C:\xampp\htdocs\yu" "C:\Users\sirben\AppData\Local\Temp\Gea9A67.tmp.docx"" What is it that am doing wrong?

Thank you

shift-reality commented 7 years ago

You use windows. This is not allowed :)