Search code examples
phpfpdf

SetDrawColor() is behaving like SetFillColor()


enter image description here

SetDrawColor() supposed to color Cell frame but instead another color is rendering as background color. This is the whole code :-

    $pdf = new FPDF();
    $pdf->SetTextColor(103, 58, 183);
    $pdf->SetDrawColor(0, 80, 180);
    // Fourth Page --
    $pdf->AddPage();
    $pdf->SetFont('Arial','B',16);
    $pdf->Cell(0, 10, "Hello Santanu", 1, 1, 'C', true);

    $pdf->Output('helo.pdf', 'D');

Solution

  • You should try using SetFillColor before drawing any cell because it's taking black as default.

    $pdf->SetFillColor(0, 0, 0);