| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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 Write($height, $text, $link = "") {
- $font_size = $this->GetFontSize();
- if(empty($text)) {
- $text = "N/A";
- }
- if($text == "N/A") {
- $this->SetTextColor(192, 192, 192);
- }
- parent::Write($height, $text, $link);
- call_user_func_array([$this, "SetTextColor"], $this->currentTextColor);
- // Restore font size
- $this->SetFontSize($font_size);
- }
- 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);
- }
- public function MoveX($adjustment) {
- $this->SetX($this->GetX() + $adjustment);
- }
- public function MoveY($adjustment) {
- $this->SetY($this->GetY() + $adjustment);
- }
- }
- ?>
|