require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(); $pdf->AddPage(); $pdf->Rect(10, 10, 50, 30, 'D'); $pdf->Output('example.pdf', 'I');
require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(); $pdf->AddPage(); $pdf->SetFillColor(255, 0, 0); $pdf->Rect(10, 10, 50, 30, 'DF'); $pdf->SetFillColor(0, 255, 0); $pdf->Rect(70, 10, 50, 30, 'DF'); $pdf->SetFillColor(0, 0, 255); $pdf->Rect(130, 10, 50, 30, 'DF'); $pdf->Output('example.pdf', 'I');In this example, three rectangles of different colors are drawn on the PDF page using TCPDF's SetFillColor function. The 'DF' argument specifies a filled rectangle with a solid line style. TCPDF is a standalone library and does not require any external package libraries.