Convert DOC to PDF using DomPDF and PhpDocx

422 Views Asked by At

I am trying to convert .docx file to .pdf file by using dompdf and phpdocx. But I am getting error as -

file_put_contents(output_files/img6203609b73e9bc858.png): failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): file_put_contents(output_files/img6203609b73e9bc858.png): failed to open stream: No such file or directory at C:\\xampp\\htdocs\\customer-api-2.0.1\\vendor\\phpdocx\\Classes\\Phpdocx\\Transform\\TransformDocAdvDOMPDF.php:478)

Here is my code -

    require_once '../vendor/dompdf/dompdf/autoload.inc.php';
    $docx = new \Phpdocx\Create\CreateDocx();
    $path = storage_path('app');
    $dompdf = new \Dompdf\Dompdf();
    $transform = new \Phpdocx\Transform\TransformDocAdvDOMPDF($path.'\document.docx');
    $transform->setDOMPDF($dompdf);
    $transform->transform($path.'\document.pdf');

I am badly stuck here. Can anyone help me to resolve this error or suggest me any other alternative to achieve my aim

0

There are 0 best solutions below