EMfinanga
143
13
Laravel

PRINT PDF, HTML to DomPdf

Posted 1 week ago by EMfinanga

how can i convert HTML to PDF document, i have tried the below code but it does not convert to pdf its comes with HTML layout

                       // Send data to the view using loadView function of PDF facade
                        $pdf = 
                       PDF::loadView('report.printreport',compact('sales','Expenses',
                            'totalexpenses','totalAmount','customersaleview','totalAmountcustomer'));
                   // If you want to store the generated pdf to the server then you can use the store function
                        $pdf->save(storage_path().'_filename.pdf');
                // Finally, you can download the file using download function
                    return $pdf->download('generalReport.pdf');

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.