'يناير', 'February' => 'شهر فبراير', 'March' => 'يمشي', 'April' => 'أبريل', 'May' => 'يمكن', 'June' => 'يونيو', 'July' => 'يوليو', 'August' => 'أغسطس', 'September' => 'سبتمبر', 'October' => 'اكتوبر', 'November' => 'شهر نوفمبر', 'December' => 'ديسمبر' ]; if (isset($months_arabic[$letter_details->write_month])) { $month_arabic = $months_arabic[$letter_details->write_month]; } $pdf = new \Mpdf\Mpdf([ 'mode' => 'utf-8', 'default_font' => 'Arial', // Change this to the Arabic font you want to use 'default_font_size' => 12, 'autoScriptToLang' => true, 'autoLangToFont' => true, ]); $pdf->autoScriptToLang = true; $pdf->autoLangToFont = true; $pdf->setSourceFile(FCPATH . '/public/uploads/ticket_letter_format/mastcard.pdf'); // absolute path to pdf file // Import the first page of the template $tplIdx = $pdf->importPage(1); // Add pages and apply the template to each one for ($i = 0; $i < 2; $i++) { $pdf->AddPage('P'); $pdf->useTemplate($tplIdx); // Set content for each page $pdf->SetFont('aealarabiya', '', 11); // Font Name, Font Style (eg. 'B' for Bold), Font Size $htmlContent = '
Ref No : ' . $letter_details->id . '
Date : ' . $letter_details->write_date_only . " " . $letter_details->write_month . " " . $letter_details->write_year . '
Attachement : No
'; $pdf->SetXY(35, 13); $pdf->WriteHTML($htmlContent); // Arabic Date $arabic_dt = $letter_details->write_date_only . " " . $month_arabic . " " . $letter_details->write_year; $htmlContent1 = '
9 : الرقم
' . $arabic_dt . ' : التاريخ
' . ucfirst($attachment_arabic) . ' : المرفقات
'; $pdf->SetXY(5, 13); $pdf->WriteHTML($htmlContent1); $pdf->SetXY(50, 53); $htmlContent2 = '

' . $letter_details->directed_to . '

'; $htmlContent2 .= '

' . $letter_details->details . '

'; $pdf->WriteHTML($htmlContent2); $pdf->SetXY(50, 223); $speech = ''; if ($letter_details->sentences_end_of_speech == 1) { $speech = 'وتقبلوا أطيب تحياتي وتقديري,,'; } elseif ($letter_details->sentences_end_of_speech == 2) { $speech = 'وتقبلوا وافر التحية والتقدير,,'; } elseif ($letter_details->sentences_end_of_speech == 3) { $speech = 'Please accept my deepest regards and appreciation'; } elseif ($letter_details->sentences_end_of_speech == 4) { $speech = 'Yours sincerely'; } $htmlContent3 = '
' . $speech . '
'; $pdf->WriteHTML($htmlContent3); } $file_name = 'LTR_' . rand(10000, 99999) . '.pdf'; $path = FCPATH . "public/uploads/letter_pdf_files/$file_name"; $pdf->Output($path, 'I'); exit; ?>