How can one effectively troubleshoot and debug issues related to SetFillColor in FPDF?

Issue: When using SetFillColor in FPDF, if the color is not being applied as expected, it could be due to incorrect color format or values being out of range. To troubleshoot this issue, double-check the color values being passed to SetFillColor and ensure they are within the valid range of 0 to 255.

// Example code snippet to troubleshoot SetFillColor in FPDF

// Initialize FPDF
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();

// SetFillColor with incorrect color values
$pdf->SetFillColor(300, 50, 50);

// Check if color values are within valid range
if ($pdf->R >= 0 && $pdf->R <= 255 && $pdf->G >= 0 && $pdf->G <= 255 && $pdf->B >= 0 && $pdf->B <= 255) {
    // Correct color values
    $pdf->SetFillColor(255, 0, 0);
} else {
    // Incorrect color values
    echo "Invalid color values. Please ensure values are within the range of 0 to 255.";
}

// Output PDF
$pdf->Output();