SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 022'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', "B", 12); // add a page $pdf->AddPage(); $pdf->SetLineWidth(1); $pdf->SetDrawColor(50, 0, 0, 0); $pdf->SetFillColor(100, 0, 0, 0); $pdf->SetTextColor(100, 0, 0, 0); $pdf->Rect(30, 60, 20, 20, 'DF'); $pdf->Text(30, 82, 'Cyan'); $pdf->SetDrawColor(0, 50, 0, 0); $pdf->SetFillColor(0, 100, 0, 0); $pdf->SetTextColor(0, 100, 0, 0); $pdf->Rect(60, 60, 20, 20, 'DF'); $pdf->Text(60, 82, 'Magenta'); $pdf->SetDrawColor(0, 0, 50, 0); $pdf->SetFillColor(0, 0, 100, 0); $pdf->SetTextColor(0, 0, 100, 0); $pdf->Rect(90, 60, 20, 20, 'DF'); $pdf->Text(90, 82, 'Yellow'); $pdf->SetDrawColor(0, 0, 0, 50); $pdf->SetFillColor(0, 0, 0, 100); $pdf->SetTextColor(0, 0, 0, 100); $pdf->Rect(120, 60, 20, 20, 'DF'); $pdf->Text(120, 82, 'Black'); $pdf->SetDrawColor(128, 0, 0); $pdf->SetFillColor(255, 0, 0); $pdf->SetTextColor(255, 0, 0); $pdf->Rect(30, 100, 20, 20, 'DF'); $pdf->Text(30, 122, 'Red'); $pdf->SetDrawColor(0, 127, 0); $pdf->SetFillColor(0, 255, 0); $pdf->SetTextColor(0, 255, 0); $pdf->Rect(60, 100, 20, 20, 'DF'); $pdf->Text(60, 122, 'Green'); $pdf->SetDrawColor(0, 0, 127); $pdf->SetFillColor(0, 0, 255); $pdf->SetTextColor(0, 0, 255); $pdf->Rect(90, 100, 20, 20, 'DF'); $pdf->Text(90, 122, 'Blue'); $pdf->SetDrawColor(50); $pdf->SetFillColor(128); $pdf->SetTextColor(128); $pdf->Rect(30, 140, 20, 20, 'DF'); $pdf->Text(30, 162, 'Gray'); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_022.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ ?>