Search code examples
phpdompdf

DOMPDF error: Class Dompdf\FrameDecorator\AbstractFrameDecorator not fund


I'm getting this error:
Fatal error: Class 'Dompdf\FrameDecorator\AbstractFrameDecorator' not found in /public_html/vendor/dompdf/dompdf/src/FrameDecorator/Page.php on line 23
Locally works just fine, but on live server is trowing that error

$dompdf = new Dompdf();
$dd = (OBJECT)array(
    'ss'=>$data->ss,
    'cr'=>date('Y-m-d'),
    'c_n'=>$data->c_n
);
$path = PHCERT .'/';
$dompdf->set_option('defaultFont', 'Courier');
$view = $this->view()->make('pdf.cert', compact('dd'))->render();
$dompdf->loadHtml($view);
$dompdf->setPaper('A4', 'landscape');

$dompdf->render();
$oupdf = $dompdf->output();
$f_name = $data->names.'_'.time().'_'.$data->radn.'.pdf';

if(!file_put_contents($path . $f_name, $oupdf)) {
    $res['file_path'] = 'fail';
}

I the php error log doesn't say much but the same error, the apache error log doesn't say anything about it... so, I have no idea what that error only happen on live server...
php version on live server is 5.6.30
php version on local server is 5.6.25

I'm using the most recent version of dompdf, as well my other libs. I'm using composer to update my libs... I have no idea whats the problem...


Solution

  • Updating composer PSR-4 seems to fix this: composer dump-autoload -o did in fact fixed the problem.

    I did check for the class to exist before the update, after that there wasn't much change on the files dompdf, specially files inside FrameDecorator, none of them changed, the question remains, what could be cause for that error to show?... no bad html, no need for html5 and no bad css... who knows...