使用 DomPDF 和 PhpDocx 将 DOC 转换为 PDF

问题描述

我正在尝试使用 dompdf 和 phpdocx 将 .docx 文件转换为 .pdf 文件。但我收到错误 -

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)

这是我的代码 -

    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');

我被困在这里了。任何人都可以帮助我解决错误或建议我实现目标的任何其他替代方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)