@php @include('tcpdf/tcpdf.php'); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, 'px', PDF_PAGE_FORMAT, true, 'UTF-8', false); // set header and footer fonts $pdf->setHeaderFont([PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN]); $pdf->setFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA]); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); // set auto page breaks $pdf->SetAutoPageBreak(false, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font // $pdf->SetMargins(40, 1, 40); $pdf->SetFont('helveticaB', 'B', 22); $pdf->SetFillColor(255, 255, 255); // add a page $pdf->AddPage('P'); $y = 40; $x = 60; $invoice_image = 'storage/product_images/invoice.png'; $pdf->Image($invoice_image, 0, 0, 595, 837, '', '', 'T', false, 300, '', false, false, 0, false, false, false); $pdf->SetFont('freeserif', 'B', 16); $pdf->SetTextColor(102, 151, 255); $pdf->MultiCell(150, 10, $bill->bill_no, 0, 'C', true, 1, '400', '55', true, 0, false, true, 0, 'T', false); $pdf->SetFont('freeserif', 'B', 10); $pdf->SetTextColor(255, 255, 255); $pdf->MultiCell(150, 10, $customer->name, 0, 'C', true, 1, '100', '117', true, 0, false, true, 0, 'T', false); $pdf->MultiCell(150, 10, $customer->address, 0, 'C', true, 1, '100', '133', true, 0, false, true, 0, 'T', false); $pdf->MultiCell(150, 10, $customer->phone, 0, 'C', true, 1, '100', '153', true, 0, false, true, 0, 'T', false); $pdf->SetFont('freeserif', 'B', 9); $pdf->SetTextColor(0, 0, 0); $i = 1; foreach ($bill_items as $row) { $pdf->Cell(200, 8, $row->stock->cats->title, 0, 1, 'C', false); $pdf->Cell(300, 8, $row->stock->cats->title, 0, 1, 'C', false); $i++; } $pdf->SetTextColor(0, 0, 0); $style = [ 'position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => [0, 0, 0], 'bgcolor' => false, //array(255,255,255) 'module_width' => 1, // width of a single module in points 'module_height' => 1, // height of a single module in points ]; $url = url('https://mfa.gov.af/vehicle/official/'); // $barcode ="MOFA-IT# ".$card->id.":: Driver ".$driver_name_en."Department: /".$department_en."Plate Number: ".$plate_number_en."Engin Number:".$engin_number_en."Chassis Number:".$shasi_number_en; // $pdf->write1DBarcode($barcode, 'C39', '390','480','',40,0.7, $style, 'N'); // $pdf->MultiCell(110, 10, 'Reg '.'Registeration Number', 0, 'C', true, 1, '395', '520', true, 0, false, true, 0, 'T', false); $pdf->write2DBarcode($url, 'QRCODE,H', 500, 580, 60, 60, $style, 'N'); // $pdf->write2DBarcode('Qrcode', 'QRCODE,H', 80, 60, 0, 0, $style, 'N'); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('Pacha-paints-Invoices.pdf', 'I'); exit(); @endphp