Я хочу изменить цвет шрифта текста в PDF, чтобы отсутствующий был красным, а настоящий - зеленым.Как я могу добавить их в эти коды?Нужна помощь для начинающего.Большое спасибо.Кстати, я использовал fpdf, чтобы сделать вывод загружаемым PDF.
<?php
//include connection file
include "db.php";
include_once('fpdf.php');
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
// $this->Image('https://i2.wp.com/tutorialswebsite.com/wp-content/uploads/2016/01/cropped-LOGO-1.png',10,10,50);
$this->SetFont('Arial','B',13);
// Move to the right
$this->Cell(80);
// Title
$this->Cell(80,10,'ICT-5 Attendance',1,0,'C');
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
Должен ли я добавить это здесь?
$display_heading = array('roll_number'=>'Roll Number', 'student_name'=> 'Name of Student', 'attendance_status'=> 'Attendance Status','id'=> 'DATABASE ID Num.','date'=> 'Date');
$result = mysqli_query($conn, "SELECT id, student_name, roll_number, attendance_status, date FROM attendance_records WHERE date ='$_POST[date]'") or die("database error:". mysqli_error($conn));
$header = mysqli_query($conn, "SHOW columns FROM attendance_records WHERE field != 'created_on'");
$pdf = new PDF();
//header
$pdf->AddPage();
//foter page
$pdf->AliasNbPages();
$pdf->SetFont('Arial','B',10);
foreach($header as $heading) {
$pdf->Cell(39,10,$display_heading[$heading['Field']],1);
}
foreach($result as $row) {
$pdf->SetFont('Arial','I',8.5);
$pdf->Ln();
foreach($row as $column)
$pdf->Cell(39,10,$column,1);
}
$pdf->Output();
?>