@php $file = 'generated_qrcodes/'.$student->id.'.png'; $style = array( 'border' => 0, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(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 ); // ../pages/student/delete @include('tcpdf/tcpdf.php'); // @include('../pages/Cards/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(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(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->SetFont('helveticaB', 'B', 22); $pdf->SetFillColor(255, 255, 255); // add a page $pdf->AddPage('L'); $y = 40; $x = 60; $template ='images/student_id_card.jpg'; $pdf->Image($template, 0, 0, 853, 595, '', '', 'T', false, 300, '', false, false, 0, false, false, false); $pdf->SetFont('freeserif', 'B', 14); // $pdf->SetFont('Calibri', 'B', 30); $fontname = TCPDF_FONTS::addTTFfont('fonts/calibrib.ttf', 'TrueTypeUnicode', '', 96); $pdf->SetFont($fontname, '', 30); $pdf->setRTL(false); // cehck here if ar or en $pdf->SetTextColor(0, 71, 179); $pdf->MultiCell(540, 10, $student->name, 0, 'C', true, 1, '158', '402', true, 0, false, true, 0, 'T', false); $pdf->SetTextColor(0,0,0); $pdf->MultiCell(540, 10, 'ID:'.$student->id, 0, 'C', true, 1, '158', '432', true, 0, false, true, 0, 'T', false); $user_img = 'student_images/'.$student->image; $pdf->Image($user_img, 322, 192, 190, 190, '', '', 'T', false, 300, '', false, false, 0, false, false, false); $pdf->StartTransform(); $pdf->SetTextColor(0,0,0); $style = array( 'position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 71, 179), 'bgcolor' => array(255,255,255), 'module_width' => 1, // width of a single module in points 'module_height' => 1 // height of a single module in points ); $pdf->SetTextColor(0, 71, 179); $pdf->MultiCell(540, 10, 'Expires:', 0, 'L', true, 1, '518', '485', true, 0, false, true, 0, 'T', false); $pdf->MultiCell(540, 10, 'December:', 0, 'L', true, 1, '518', '514', true, 0, false, true, 0, 'T', false); $year = Date("Y"); $pdf->MultiCell(540, 10, '31, '.$year, 0, 'L', true, 1, '518', '544', true, 0, false, true, 0, 'T', false); $barcode = " ID: ". $student->id. " Name: ". $student->name; $pdf->SetTextColor(0, 71, 179); $pdf->write2DBarcode($barcode, 'QRCODE,H', 670, 465,135, 135, $style, 'N'); $pdf->SetFont('freeserif', 'B', 15); $pdf->SetTextColor(255,255,255); $pdf->SetFont('freeserif', '', 11); $pdf->SetTextColor(0,0,0); $style = array( 'position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(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 ); $pdf->lastPage(); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('Student Card#-'.$student->name.'.'.$student->id.'.pdf', 'I'); exit; @endphp