barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.73k stars 969 forks source link

Browser not rendering PDF correctly in Laravel #1060

Closed kalehege closed 3 months ago

kalehege commented 3 months ago

Screenshot 2024-07-17 205620 how i fix that

    $pdf = PDF::loadView('pdf.cv', ['candidates_data' => $candidate])->setPaper('A3', 'portrait');

    return $pdf->stream('cv-'.$request->em_id.'pdf');
parallels999 commented 3 months ago

https://github.com/dompdf/dompdf/issues/3375#issuecomment-1889980894

kalehege commented 3 months ago

dompdf/dompdf#3375 (comment)

same results man

parallels999 commented 3 months ago

It works for me, make a demo showing the problem, surely you have something wrong

kalehege commented 3 months ago

public function generateCV(Request $request) {

    $candidate = Candidate::with(
        'job',
        'education_infos',
        'professional_qus',
        'language_skills',
        'employment_histories',
        'other_emplies',
        'vaccinations',
        'professional_qus',
        'professional_refers'
    )
        ->find($request->candidate_id);

// dd($candidate);

    $pdf = PDF::loadView('pdf.cv', ['candidates_data' => $candidate])->setPaper('A3', 'portrait');

    return $pdf->download('cv-'.$request->em_id.'pdf');
}

my code like this
kalehege commented 3 months ago

It works for me, make a demo showing the problem, surely you have something wrong

public function generateCV(Request $request) {

    $candidate = Candidate::with(
        'job',
        'education_infos',
        'professional_qus',
        'language_skills',
        'employment_histories',
        'other_emplies',
        'vaccinations',
        'professional_qus',
        'professional_refers'
    )
        ->find($request->candidate_id);

// dd($candidate);

    $pdf = PDF::loadView('pdf.cv', ['candidates_data' => $candidate])->setPaper('A3', 'portrait');

    return $pdf->download('cv-'.$request->em_id.'pdf');
}
my code like this
parallels999 commented 3 months ago

it works 👍 make a demo showing the problem, surely you have something wrong somewhere else in your application

kalehege commented 3 months ago

it works 👍

same bro image

parallels999 commented 3 months ago

make a demo showing the problem, surely you have something wrong somewhere else in your application

Fresh laravel instalation, only showing the problem

kalehege commented 3 months ago

it works 👍

same bro image

It works with IDM Download Manager, but it doesn't work with browser downloads.

parallels999 commented 3 months ago

Maybe the browser, Your screenshots don't give much information, you could be showing me an iframe and I don't even know