how to solve error: Call to a member function get_cellmap() on null in laravel-dompdf in laravel 9

140 Views Asked by At

I am trying to download a file in PDF format using Laravel DomPDF from the following link: https://github.com/barryvdh/laravel-dompdf. However, when I click the button to generate the PDF, an error 'Call to a member function get_cellmap() on null' appears in the return $pdf->stream($pdfName); part. The following is my generatePDF function:

    public function generatePdf(Request $request)
{
    $check    = UserProfileModel::with('user')->where('user_id', auth()->user()->id)->first();
    $assign   = UserAssignModel::with('agency', 'job', 'user', 'pic')
                ->where('peserta_id', $check->user_id)
                ->first();
    $agency   = AgencyProfileModel::where('id',$assign->agency_id)->first();
    $logbook  = LogbookModel::with('task')->where('peserta_id', $assign->peserta_id)->get();
    $jobdetail= DB::table('job_has_timeline')->where('job_id',$assign->job_id)->first();
    // dd($jobdetail);
    $data = [
        'check'     => $check->user->account->intern_status,
        'assign'    => $assign,
        'agency'    => $agency,
        'data'      => $check,
        'logbook'   => $logbook,
        'jobdetail' => $jobdetail,
    ];
    $pdfName = "Report-" . ucwords(strtolower($agency->name)) . "-" . ucwords(strtolower($check->full_name)) . ".pdf";
    $pdf     = Pdf::loadView('Users.monev.exportpdf', $data);
    return $pdf->stream($pdfName);
}

The following is the picture: enter image description here

0

There are 0 best solutions below