I don't think that's possible.
Just return a response that contains the file URL and redirect to it using :
window.location.href = response.FILEURL;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I'm using DOMPDF to generate PDFs and it works good. But, when I try to pass some info from one view to another to generate PDF it doesn work, here are my files: FILE:Factura.blade.php $('#generaPDF').click(function() { $htmlData = "hola"; $_token = $('[name="_token"]').val(); $.post('recibos/pdf',{ html:$htmlData, _token: $_token }) .done(function(data){ console.log('Done');}); });
On rutes.php I have the post method to redirect to Controller:
FILE: FacturaController.php
public function reciboPDF(Request $request) { $data = array(); $data['param']=$request->get('htmlData'); $pdf = \PDF::loadView('create.template.formReciboPDF',$data)->setPaper('letter')->setOrientation('landscape'); $pdf->download('test.pdf'); //$pdf->stream(); }
TEMPLATE PDF: extends('pdf') section('content') (HTML CODE) table class="table" tr th{{$param}}/th thDepartamento/th thUnidad de Medida/th And so on....
Please or to participate in this conversation.