ุงูุณูุงู
ุนูููู
๐
ุฌุงู ุจุนุฏ ุบูุงุจ ุทููู ุจู
ูุงูุฉ ุจุณูุทุฉ ู ูุชููู
ุนู ู
ุดููุฉ ูู ุงูุนุฑุจ ุจููุงุจูููุง ูู ูุงุฑููู ู ูู ุฅู ุฅุฒุงู ุชุทุจุน PDF ุนุฑุจู ู
ู ุบูุฑ ุงู ู
ุดููุฉ ูู ุงู encoding ๐
ููุณุชุฎุฏู
ุจุงูุฏุฌ TCPDF ูู ุงูู
ูุถูุน ุฏุง, ุชุนุงููุง ุงูุฃูู ูุนู
ูููุง install ุนู ุทุฑูู ุงู command ุฏุง ๐
composer require tecnickcom/tcpdf
ู ุฏูููุชู ุจูุง ุฌู ููุช ุงูููุฏ ๐จ๐ป
use App\Models\User;
use TCPDF;
class PDFController extends Controller
{
/**
* Generate the PDF of the user then download it.
*/
public function generate(User $user)
{
$filename = "{$user->name}.pdf";
$pdf = new TCPDF(
PDF_PAGE_ORIENTATION,
PDF_UNIT,
PDF_PAGE_FORMAT,
true,
'UTF-8',
false
);
$pdf->SetTitle($user->name);
$pdf->setRTL(true);
$pdf->SetFont('aefurat', '', 16);
$pdf->AddPage();
$html = view('user.show', compact('user'))->render();
$pdf->writeHTML($html, true, false, true, false, '');
// Preview the PDF without storing and downloading it
$pdf->Output(public_path($filename));
// Store the PDF as a file then download it
// $pdf->Output(public_path($filename), 'F');
// Download the PDF directly without storing it
// $pdf->Output(public_path($filename), 'D');
// > [!NOTE]
// > You can also create a mix between two of these flags...
return response()->download(public_path($filename));
}
}
ุฎูู ุจุงูู ุงู ุงูุจุงูุฏุฌ ุฏู sensitive ูู ุงู HTML Tags ูุง ูู ูุณูุช ุชููู ุชุงุฌ ุงู ูุชุจุชู ุบูุท ููุทูุนูู ุฅูุณุจุดู.
ู ุฏุง example ุฎุงุต ุจุงูุจุงูุฏุฌ ุจููุถุญ ุฅุฒุงู ุชุนู
ู ูุฏุง ุจุดูู ู
ููุตู ุงูุชุฑ...๐ง
ู ุจูุฏุง ุฃููู ุฎูุตุช ู ุฃุชู
ูู ุชููู ุฅุณุชูุฏุช โ