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

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:29n@resource://pdf.js/build/pdf.mjs:456:2n" }

can you please advice ?