PHP FPDF Mengisi Cell dengan Background Warna

Untuk membuat Report PDF dengan clas FPDF kadang kita ingin mengisi cell dengan background warna

Menggunakan function :

SetFillColor(int r [, int g, int b])

yang mana diisi dengan warna RGB.

Contoh :

$pdf = new FPDF();
$pdf->SetTitle(‘Invoice’);

$pdf->AddPage();

$pdf->Ln(5);

// Set Background warna pada cell
        $pdf->SetFillColor(210,221,242);
$pdf->SetFont( ‘Arial’, ‘B’, 10 );
$pdf->Cell( 185, 5,  ‘Note’ ,0,1,”,true );
$pdf->SetFont( ‘Arial’, ”, 10 );

// Text dalam cell
$pdf->Cell( 185, 4,  ‘Upon the above fee (VAT excluded), please withhold Income Tax Art. 23 (Non Final Income Tax) at 2% (according ‘ ,0,1,”,true);
$pdf->Cell( 185, 4,  ‘to Law of The Republic of Indonesia number 36 of 2008). Please send withholding Slip to us along with the payment ‘ ,0,1,”,true);
$pdf->Cell( 185, 5,  ‘note’ ,0,1,”,true );

 

// Untuk keluaran

$pdf->output();

Akan menghasilkan :

Gambar

 

Sumber :

http://devmanuals.com/tutorials/php/cell-with-background-fill.html

http://www.fpdf.org/en/doc/setfillcolor.htm

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s