1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Download PDF in Laravel 9 using barryvdh/laravel-dompdf give us a pdf file corrupted

Discussão em 'Outras Linguagens' iniciado por mmantach, Outubro 12, 2024 às 06:02.

  1. mmantach

    mmantach Guest

    trying to download file using barryvdh/laravel-dompdf from html render view

    // Generate the PDF from the HTML content
    $pdf = PDF::loadHTML($contract_document)->setPaper('a4', 'landscape')
    ->setOption('zoom', 1.2)
    ->setOption('footer-center', '')
    ->setOption('footer-font-size', 5);


    return $pdf->download($ad_id . '.pdf');


    it download file corrupted if if I open in pdf fire fox it give me the below error :

    Invalid or corrupted PDF file.

    PDF.js v4.7.18 (build: 9735a840a)
    Message: Invalid PDF structure. viewer.mjs:12184:13
    Uncaught (in promise)
    Object { message: "Invalid PDF structure.", name: "InvalidPDFException", stack: "BaseExceptionClosure@resource://pdf.js/build/pdf.mjs:453:29\n@resource://pdf.js/build/pdf.mjs:456:2\n" }


    can you please advice ?

    Continue reading...

Compartilhe esta Página