| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- class TestPDF extends FPDF {
- private $currentTextColor = [0, 0, 0];
- public function GetFontSize() {
- return $this->FontSizePt;
- }
- public function SetTextColor($r, $g = null, $b = null) {
- if($r != 192) {
- $this->currentTextColor = [$r, $g, $b];
- }
- parent::SetTextColor($r, $g, $b);
- }
- public function Cell($width, $height = 0, $text = "", $border = 0, $line_mode = 0, $align = "", $fill = false, $link = "") {
- $font_size = $this->GetFontSize();
- if(empty($text)) {
- $text = "N/A";
- }
- if($text == "N/A") {
- $this->SetTextColor(192, 192, 192);
- $this->SetFontSize($font_size - 2);
- }
- parent::Cell($width, $height, $text, $border, $line_mode, $align, $fill, $link);
- call_user_func_array([$this, "SetTextColor"], $this->currentTextColor);
- // Restore font size
- $this->SetFontSize($font_size);
- }
- }
- ?>
|