php - tcpdf page number getting 0 -


in tcpdf trying add page, , getting wrong page number on setpage() function: 0, can not find way solve.

here code:

require_once('../tcpdf.php'); // extend tcpdf class create custom header , footer class mypdf extends tcpdf { //page header public function test( $ae ) {     if( !isset($this->xywalter) ) {         $this->xywalter = array();     }     $this->xywalter[] = array($this->getx(), $this->gety()); } }  // create new pdf document $pdf = new mypdf('l', pdf_unit, 'a1', true, 'utf-8', false);  // set rotate $params = $pdf->serializetcpdftagparameters(array(90));  // other configs $pdf->setopencell(0); $pdf->setcellpadding(0); $pdf->setcellheightratio(1.25);  // create html content $html = '<table width="100%" border="1" cellspacing="0" cellpadding="5"> <thead> <tr bgcolor="#e6e6e6"> <th rowspan="2" width="15%" align="center">atividades e processos</th> <th rowspan="2" width="10%" align="center" valign="bottom">aspectos</th> <th rowspan="2" width="10%" align="center">impactos</th> <th colspan="3" width="6%" align="center">meio</th> <th rowspan="2" width="3%" align="center"><tcpdf method="test" params="'.$params.'" /></th> <th colspan="9" width="18%" align="center">classifica&ccedil;&otilde;es</th> <th rowspan="2" width="3%" align="center"><tcpdf method="test" params="'.$params.'" /></th> <th rowspan="2" width="10%" align="center">programa</th> <th rowspan="2" width="10%" align="center">subprograma</th> <th rowspan="2" width="15%" align="center">a&ccedil;&otilde;es de controle, medidas mitigadoras, compensat&oacute;rias e potencializadoras</th> </tr> <tr bgcolor="#e6e6e6"> <th align="center" height="200"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> <th align="center"><tcpdf method="test" params="'.$params.'" /></th> </tr> </thead> <tr bgcolor="#e6e6e6"> <td colspan="20" align="center">planejamento</td> </tr> <tr bgcolor="#ffffff"> <td rowspan="3" width="15%" align="left" bgcolor="#ffffff">divulga&ccedil;&atilde;o empreendimento</td> <td rowspan="2" width="10%" align="left">oferta de empregos diretos e indiretos</td> <td rowspan="2" width="10%" align="left">atra&ccedil;&atilde;o de popula&ccedil;&atilde;o para comunidades entorno</td> <td rowspan="2" width="2%" align="center"></td> <td rowspan="2" width="2%" align="center"></td> <td rowspan="2" width="2%" align="center">x</td> <td rowspan="2" width="3%" align="center">aii</td> <td rowspan="2" width="2%" align="center">-</td> <td rowspan="2" width="2%" align="center">ind</td> <td rowspan="2" width="2%" align="center">t</td> <td rowspan="2" width="2%" align="center">mp</td> <td rowspan="2" width="2%" align="center">po</td> <td rowspan="2" width="2%" align="center">d</td> <td rowspan="2" width="2%" align="center">r</td> <td rowspan="2" width="2%" align="center">m</td> <td rowspan="2" width="2%" align="center">m</td> <td rowspan="2" width="3%" align="center">m</td> <td width="10%">programa de apoio ao desenvolvimento socioeconomico da regi&atilde;o</td> <td width="10%">subprograma de apoio ao desenvolvimento habitacional</td> <td width="15%">coibir ocupa&ccedil;&atilde;o indevida de &aacute;reas inadequadas</td> </tr> <tr bgcolor="#ffffff"> <td>programa de comunica&ccedil;&atilde;o social</td> <td> -</td> <td>a&ccedil;&otilde;es de comunica&ccedil;&atilde;o sobre o empreendimento e quest&otilde;es ambientais</td> </tr> <tr bgcolor="#ffffff"> <td align="left">gera&ccedil;&atilde;o de expectativas na popula&ccedil;&atilde;o</td> <td align="left">gera&ccedil;&atilde;o de expectativas junto popula&ccedil;&atilde;o</td> <td align="center"></td> <td align="center"></td> <td align="center">x</td> <td align="center">aii</td> <td align="center">-</td> <td align="center">dir</td> <td align="center">t</td> <td align="center">im</td> <td align="center">co</td> <td align="center">l</td> <td align="center">r</td> <td align="center">p</td> <td align="center">p</td> <td align="center">b</td> <td>programa de comunica&ccedil;&atilde;o social</td> <td> -</td> <td>a&ccedil;&otilde;es de comunica&ccedil;&atilde;o sobre o empreendimento e questoes ambientais</td> </tr> </table>';  // output html content $pdf->writehtml($html, true, false, true, false, '');  // array names of columns $arr_nomes = array( array("abrangÊncia", 8, 59), // array(name, new x, new y); array("significÂncia", 8, 59), array("fÃsico", 4, 52), array("biÓtico", 4, 52), array("socioeconÔmico", 4, 52), array("natureza", 4, 52), array("origem", 4, 52), array("duraÇÃo", 4, 52), array("ocorrÊncia / temporalidade", 4, 52), array("frequÊncia", 4, 52), array("espacializaÇÃo", 4, 52), array("reversibilidade", 4, 52), array("magnitude", 4, 52), array("relevÂncia", 4, 52) );  // num of pages $ttpages = $pdf->getnumpages(); for($i=1; $i<=$ttpages; $i++) { // set page $pdf->setpage($i); // columns of current page foreach( $arr_nomes $num => $arrcols ) {     $x = $pdf->xywalter[$num][0] + $arrcols[1]; // new x     $y = $pdf->xywalter[$num][1] + $arrcols[2]; // new y     $n = $arrcols[0]; // column name     // transforme rotate     $pdf->starttransform();     // rotate 90 degrees counter-clockwise     $pdf->rotate(90, $x, $y);     $pdf->text($x, $y, $n);     // stop transformation     $pdf->stoptransform(); } }  // reset pointer last page $pdf->lastpage();  // ---------------------------------------------------------  //close , output pdf document $pdf->output('example_006.pdf', 'i'); 

i think $pdf->getnumpages(); returning 0 in for loop have added $i=1; $i<=$ttpages; $i++. here errors have got, notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17126

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17941

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 18239

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17126

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17941

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 18239

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17941

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 18239

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17126

notice: undefined offset: 0 in e:\software\html\own\office\tcpdf\tcpdf.php on line 17491 tcpdf error: wrong page number on setpage() function: 0 in advance.

try this

$pdf->addpage('p','a4'); before $html


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -