php - Unwanted lines in TCPDF class with custom header and footer -


i'm using tcpdf generate pdf reports. need custom headers , footers, extended original class overwrite header , footer methods suggested in official documentation (https://tcpdf.org/examples/example_002.phps).

here code:

class apppdf extends \tcpdf {      const logo_path =  '/../../../public_html/public/images/logo-big.png';      private $xlogo;     private $ylogo;     private $wlogo;      public function __construct($orientation='p', $unit='mm', $format='a4', $unicode=true, $encoding='utf-8', $diskcache=false, $pdfa=false, $xlogo = 8, $ylogo = 0, $wlogo = 50) {         parent::__construct($orientation, $unit, $format, $unicode, $encoding, $diskcache, $pdfa);          $this->xlogo = $xlogo;         $this->ylogo = $ylogo;         $this->wlogo = $wlogo;     }      public function header() {         $this->image(__dir__ . self::logo_path, $this->xlogo, $this->ylogo, $this->wlogo);     }      public function footer() {         $this->setxy(34,260);         $this->setfont('helvetica', 'i', 8);          $this->settextcolor(0, 0, 0);         $this->multicell(130, 20, "footer text", 0, "c", false);     }  }  

then have base template used generated documents:

class basepdf {      const creator = 'creator';     const title = 'title';     const pdf_font_name_main = 'times';     const pdf_font_size_main = 11;      protected $pdf;      public function __construct($xlogo = 8, $ylogo = 0, $wlogo = 50)     {         $this->pdf = new apppdf('p', 'mm', 'a4', true, 'utf-8', false, false, $xlogo, $ylogo, $wlogo);         $this->pdf->setcreator(self::creator);         $this->pdf->setauthor(self::creator);         $this->pdf->settitle(self::title);          $this->pdf->setfont(self::pdf_font_name_main, "", self::pdf_font_size_main);     }      public function getpdf()     {         return $this->pdf;     } } 

the base template used shown in following class:

use appbundle\entity\hpvexam;  class hpvreport extends basepdf {     public function __construct(hpvexam $hpvexam)     {         parent::__construct(8, 10, 75);          $this->pdf->addpage();     } } 

the problem code generates pdfs annoying horizontal line in top , 1 in footer, can see in following image example of unwated lines in pdfs.

i have tried suggestions provided here php / tcpdf: template bug? , here changing or eliminating header & footer in tcpdf without luck.

what i'm doing wrong? seems original header , footer methods not correctly overwritten... idea? thank you!

just tcpdf dont print header or go , modify source....

$pdf->setprintheader(false); 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -