PHPWord to PDF not able to load library

后端 未结 3 1402
我寻月下人不归
我寻月下人不归 2021-01-20 15:50

I have been trying all day to get this to work. Right now I am able to save the document as .docx file but I wanted to be able to save the document as PDF I have tried with

相关标签:
3条回答
  • 2021-01-20 16:35

    When I print the error to log, I realize it is trying to load the dompdf_config.inc.php from an invalid location. See below.

    C:\wamp\www\cccake\app\Vendor\dompdf\dompdf.php/dompdf_config.inc.php\n

    Rather than altering the class files of PHPExcel/ PHPWord, it's wise to change the configuration in your view. Ignoring the $rendererLibrary completely in the $rendererLibraryPath fixed my issue. I think the PHPExcel/PHPExcel know how to pick dompdf.php file (tcpdf.php) in your case. Try below code let us know if it doesn't work.

    $rendererLibrary = 'tcpdf.php'; $rendererLibraryPath = dirname(FILE) .'/plugins/tcpdf';

    0 讨论(0)
  • 2021-01-20 16:39

    Make sure to send DOMPDF Path in:

    $domPdfPath = "..vendor/dompdf/dompdf/";
    Settings::setPdfRendererName(Settings::PDF_RENDERER_DOMPDF);
    Settings::setPdfRendererPath($domPdfPath); //<---
    

    Then in AbstractRerender construct if you echo $this->Include file you should see 'dompdf_config.inc.php'

    If you don't have dompdf_config.inc.php file, try to use dompdf 0.6.2

    0 讨论(0)
  • 2021-01-20 16:50

    Knowing al that, I'm guessing the answer is changing:

    $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile;
    

    to

    $includeFile = Settings::getPdfRendererPath();
    
    0 讨论(0)
提交回复
热议问题