<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Barryvdh\DomPDF\Facade\Pdf;
class TestController extends Controller
{
public function test() {
$data = ['title' => 'Welcome to Viet Nam'];
$pdf = Pdf::loadView('pdf.invoice', $data);
//Nếu muốn hiển thị file pdf theo chiều ngang
// $pdf->setPaper('A4', 'landscape');
//Nếu muốn download file pdf
// return $pdf->download('myPDF.pdf');
//Nếu muốn preview in pdf
return $pdf->stream('myPDF.pdf');
}
}