returning a pdf (TCPDF) with a laravel api

I am moving a laravel app to a laravel api and I have a functionality to create pdfs with TCPDF in the laravel app it works without any problem but when I try to move this functionality to an api I am getting several errors.

  1. the pdf comes empty (this should not be happenning)

  2. the pdf comes without the name (it seems to be)

    //laravel controller code: 
    
     $filename = $odp_volumetrica->codigo . ' L ' . $odp_volumetrica->lote . '.pdf';
     $filename = str_replace(' ', '_', $filename); 
    
     header('Content-Type: application/pdf');
     header('Content-Disposition: inline; filename="' . $filename . '"');
     header('Access-Control-Allow-Origin: *');
     $pdf->Output($filename, 'I'); 
    
    
    //react client code:
         authorizedRequest
         .get('/odps/13/printCoa')
         .then(({ data }) => {
             const blob = new Blob([data], { type: 'application/pdf' });
             window.open(URL.createObjectURL(blob));
         })
         .catch((error) => {
             console.log(error);
         });
    

I would like to know if there is a way to return these pdfs and open them in a new tab in the browser and if possible its name is not a random string.