Open taha7672 opened 1 year ago
code to report generate; $title = 'Sale Comparison'; $content = view( 'admin.reports.sale_comparison', compact( 'title', 'store_id', 'compare', 'compareTo', 'sale_results', ) )->render();
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf::SetFont('Times', '', 11, '', false); $pdf::SetTitle($title); $pdf::setPrintHeader(false); $pdf::setFooterCallback(function ($pdf) { // Position at 15 mm from bottom $pdf->SetY(-15); // Set font $pdf->SetFont('helvetica', 'I', 8); // Page number $pdf->Cell(0, 10, 'Page ' . $pdf->getAliasNumPage() . '/' . $pdf->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); }); $pdf::AddPage('P', "A4"); $pdf::writeHTML($content, true, false, true, false, ''); deleteAllStoragePDFs(); $pdf::Output(storage_path('app/public/pdf/' . $title . '.pdf'), 'F'); return $path = 'storage/app/public/pdf/' . $title . '.pdf'; }
view .blade::
code to report generate; $title = 'Sale Comparison'; $content = view( 'admin.reports.sale_comparison', compact( 'title', 'store_id', 'compare', 'compareTo', 'sale_results', ) )->render();
view .blade::
{{ getConstant('SITE') }}
{{ getConstant('EMAIL') }}
PTCL-1: {{ getConstant('PTCL-1') }}
PTCL-2: {{ getConstant('PTCL-2') }}
Contact-1: {{ getConstant('Contact-1') }}
Contact-2: {{ getConstant('Contact-2') }}
Report: {{ $title }}