php - header and footer line in FPDI/TCPDF -


i'm stamping pdf documents fpdi , tcpdf functions, , i'm trying figure out, how can add line below text in header, , upon text in footer. here code:

<?php  require_once('lib/tcpdf/tcpdf.php'); require_once('fpdi.php');   $fullpathtofile = "testclanek6.pdf";    class pdf extends fpdi {      var $_tplidx;      function header() {          global $fullpathtofile;  //global          if(is_null($this->_tplidx)) {             // number of pages             $this->numpages = $this->setsourcefile($fullpathtofile);             $this->_tplidx = $this->importpage(1);         }          if($this->page > 0) {             //$this->setprintheader(true);             $this->setfont('times', 'i', 11);              $this->settextcolor(0);             $this->write(15, "vol. 1, no. 15, year: 2015, duff");             $this->image('logo.png', 100, 2, 75,7);                     } //end of if         $this->usetemplate($this->_tplidx, 0, 0,200);     }           //end of header      function footer() {         if($this->page > 0) {             $this->sety(-20);             $this->setfont('times', 'i', 11);              $this->settextcolor(0,0,0);             $this->write(0, "page", '', 0, 'c');         }  //end of if     } // end of footer }        //end of class  // new pdf file $pdf = new pdf(); $pdf->addpage();  if($pdf->numpages>0) {     for($i=1;$i<=$pdf->numpages;$i++) {         $pdf->endpage();         $pdf->_tplidx = $pdf->importpage($i);         $pdf->addpage();         //$pdf->setprintheader(false);         //$pdf->setprintfooter(false);      } } $file_time = time();  $pdf->output("$file_time.pdf", "f");//, "i");  echo "link: '<a href=$file_time.pdf>stamped article</a>'";  ?> 

i've tried lot of things setprintheader(), etc. nothing i've found works me. please help?

thank you.

duff

you can use line method draw line in fpdf. if want straight horizontal line, make sure ordinates (y values) start , end of line same. example:

$pdf->ln(15,$pdf->y,200,$pdf->y); 

you modify values suit needs , insert in overridden methods header , footer appropriate application.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -