PageRenderTime 59ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/webcore/ext/pdf/webcore.pdf.php

#
PHP | 2552 lines | 2307 code | 128 blank | 117 comment | 501 complexity | 0f2431773e64bb248890c925c715e39e MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. require_once "webcore.pdf.base.php";
  3. /**
  4. * Class to write a PDF using a HTML
  5. *
  6. * @package WebCore
  7. * @subpackage Pdf
  8. * @author original work Renato A.C. webcore implementation Geo Perez
  9. */
  10. class PdfWriter extends PdfGenerator
  11. {
  12. protected $pgwidth;
  13. protected $fontlist;
  14. protected $issetcolor;
  15. protected $titulo;
  16. protected $oldx;
  17. protected $oldy;
  18. protected $B;
  19. protected $U;
  20. protected $I;
  21. protected $tablestart;
  22. protected $tdbegin;
  23. protected $table;
  24. protected $cell;
  25. protected $col;
  26. protected $row;
  27. protected $divSettings;
  28. protected $listlvl;
  29. protected $listnum;
  30. protected $listtype;
  31. protected $listoccur;
  32. protected $listlist;
  33. protected $listitem;
  34. protected $buffer_on;
  35. protected $pbegin;
  36. protected $pjustfinished;
  37. protected $blockjustfinished;
  38. protected $SUP;
  39. protected $SUB;
  40. protected $toupper;
  41. protected $tolower;
  42. protected $dash_on;
  43. protected $dotted_on;
  44. protected $strike;
  45. protected $CSS;
  46. protected $cssbegin;
  47. protected $backupcss;
  48. protected $textbuffer;
  49. protected $currentstyle;
  50. protected $currentfont;
  51. protected $colorarray;
  52. protected $bgcolorarray;
  53. protected $enabledtags;
  54. protected $lineheight;
  55. protected $basepath;
  56. protected $outlineparam;
  57. protected $outline_on;
  58. protected $specialcontent;
  59. protected $selectoption;
  60. public function __construct($orientation='P', $unit='mm', $format='letter')
  61. {
  62. parent::__construct($orientation, $unit, $format);
  63. $this->AliasNbPages();
  64. $this->enabledtags = "<option><outline><span><newpage><page_break><s><strike><del><ins><font><center><sup><sub><input><select><option><textarea><title><form><ol><ul><li><h1><h2><h3><h4><h5><h6><pre><b><u><i><a><img><p><br><strong><em><code><th><tr><blockquote><hr><td><tr><table><div>";
  65. $this->setFont('Arial', '', 11);
  66. $this->lineheight = 5;
  67. $this->pgwidth = $this->fw - $this->lMargin - $this->rMargin ;
  68. $this->setFillColor(255);
  69. $this->titulo='';
  70. $this->oldx=-1;
  71. $this->oldy=-1;
  72. $this->B=0;
  73. $this->U=0;
  74. $this->I=0;
  75. $this->listlvl=0;
  76. $this->listnum=0;
  77. $this->listtype='';
  78. $this->listoccur=array();
  79. $this->listlist=array();
  80. $this->listitem=array();
  81. $this->tablestart=false;
  82. $this->tdbegin=false;
  83. $this->table=array();
  84. $this->cell=array();
  85. $this->col=-1;
  86. $this->row=-1;
  87. $divSettings = array ("divbegin" => false,
  88. "divalign" => "L",
  89. "divwidth" => 0,
  90. "divheight" => 0,
  91. "divbgcolor" => false,
  92. "divcolor" => false,
  93. "divborder" => 0);
  94. $this->divSettings = new KeyedCollectionWrapper($divSettings, false);
  95. $this->fontlist=array("arial","times","courier","helvetica","symbol","monospace","serif","sans");
  96. $this->issetcolor=false;
  97. $this->pbegin=false;
  98. $this->pjustfinished=false;
  99. $this->blockjustfinished = true;
  100. $this->toupper=false;
  101. $this->tolower=false;
  102. $this->dash_on=false;
  103. $this->dotted_on=false;
  104. $this->SUP=false;
  105. $this->SUB=false;
  106. $this->buffer_on=false;
  107. $this->strike=false;
  108. $this->currentfont='';
  109. $this->currentstyle='';
  110. $this->colorarray=array();
  111. $this->bgcolorarray=array();
  112. $this->cssbegin=false;
  113. $this->textbuffer=array();
  114. $this->CSS=array();
  115. $this->backupcss=array();
  116. $this->basepath = "";
  117. $this->outlineparam = array();
  118. $this->outline_on = false;
  119. $this->specialcontent = '';
  120. $this->selectoption = array();
  121. }
  122. public function setBasePath($str)
  123. {
  124. $this->basepath = dirname($str) . "/";
  125. $this->basepath = str_replace("\\","/",$this->basepath); //If on Windows
  126. }
  127. public function header($content='')
  128. {
  129. if ($content == '')
  130. return;
  131. $y = $this->y;
  132. foreach($content as $tableheader)
  133. {
  134. $this->y = $y;
  135. $x = $tableheader['x'];
  136. $w = $tableheader['w'];
  137. $h = $tableheader['h'];
  138. $va = $tableheader['va'];
  139. $mih = $tableheader['mih'];
  140. $border = $tableheader['border'];
  141. $align = $tableheader['a'];
  142. $this->divalign=$align;
  143. $this->x = $x;
  144. if (!isset($va) || $va=='M')
  145. $this->y += ($h-$mih)/2;
  146. elseif (isset($va) && $va=='B')
  147. $this->y += $h-$mih;
  148. if (isset($border) and $border != 'all')
  149. $this->_tableRect($x, $y, $w, $h, $border);
  150. elseif (isset($border) && $border == 'all')
  151. $this->Rect($x, $y, $w, $h);
  152. $value = $w-2;
  153. $this->divSettings->setValue("divwidth", $value);
  154. $this->divheight = 1.1*$this->lineheight;
  155. $textbuffer = $tableheader['textbuffer'];
  156. if (!empty($textbuffer))
  157. $this->printbuffer($textbuffer,false,true/*inside a table*/);
  158. $textbuffer = array();
  159. }
  160. $this->y = $y + $h;
  161. }
  162. public function footer()
  163. {
  164. $this->setY(-10);
  165. $this->setFont('Arial', 'B', 9);
  166. $this->setTextColor(0);
  167. $this->setFont('Arial','I',9);
  168. $this->Cell(0,10,$this->PageNo().'/{nb}', 0, 0, 'C');
  169. $this->setFont('Arial','',11);
  170. }
  171. public function writeHTML($html)
  172. {
  173. if($this->page==0) $this->addPage();
  174. $html = $this->adjustHtml($html);
  175. $html = $this->readCss($html);
  176. $html = str_replace('<?','< ',$html);
  177. $html = strip_tags($html,$this->enabledtags);
  178. $a = preg_split('/<(.*?)>/ms',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
  179. foreach($a as $i => $e)
  180. {
  181. if($i%2==0)
  182. {
  183. if (strpos($e,"&") !== false)
  184. {
  185. if (strpos($e,"#") !== false)
  186. $e = $this->value_entity_decode($e);
  187. $e = html_entity_decode($e,ENT_QUOTES,'cp1252');
  188. }
  189. $e = str_replace(chr(160),chr(32),$e);
  190. if (strlen($e) == 0)
  191. continue;
  192. if ($this->toupper) $e = strtoupper($e);
  193. if ($this->tolower) $e = strtolower($e);
  194. if($this->titulo)
  195. $this->setTitle($e);
  196. elseif($this->specialcontent)
  197. {
  198. if ($this->specialcontent == "type=select" and $this->selectoption['ACTIVE'] == true)
  199. {
  200. $stringwidth = $this->GetStringWidth($e);
  201. if (!isset($this->selectoption['MAXWIDTH']) or $stringwidth > $this->selectoption['MAXWIDTH'])
  202. $this->selectoption['MAXWIDTH'] = $stringwidth;
  203. if (!isset($this->selectoption['SELECTED']) or $this->selectoption['SELECTED'] == '')
  204. $this->selectoption['SELECTED'] = $e;
  205. }
  206. else
  207. $this->textbuffer[] = array("»¤¬"/*identifier*/.$this->specialcontent."»¤¬".$e);
  208. }
  209. elseif($this->tablestart)
  210. {
  211. if($this->tdbegin)
  212. {
  213. $this->cell[$this->row][$this->col]['textbuffer'][] = array($e,'',$this->currentstyle,
  214. $this->colorarray,$this->currentfont,
  215. $this->SUP,$this->SUB,'',$this->strike,
  216. $this->outlineparam,$this->bgcolorarray);
  217. $this->cell[$this->row][$this->col]['text'][] = $e;
  218. $this->cell[$this->row][$this->col]['s'] += $this->GetStringWidth($e);
  219. }
  220. }
  221. elseif($this->pbegin or $this->divSettings->getValue("divbegin") or $this->SUP or $this->SUB or $this->strike or $this->buffer_on)
  222. {
  223. $this->textbuffer[] = array($e, '',$this->currentstyle,$this->colorarray,$this->currentfont,
  224. $this->SUP,$this->SUB,'',$this->strike,$this->outlineparam,
  225. $this->bgcolorarray);
  226. }
  227. else
  228. {
  229. if ($this->blockjustfinished) $e = ltrim($e);
  230. if ($e != '')
  231. {
  232. $this->Write($this->lineheight,$e);
  233. if ($this->pjustfinished) $this->pjustfinished = false;
  234. }
  235. }
  236. }
  237. else
  238. {
  239. if ($e{0} == '/')
  240. {
  241. $this->CloseTag(strtoupper(substr($e,1)));
  242. }
  243. else
  244. {
  245. $e = preg_replace('|=\'(.*?)\'|s', "=\"\$1\"", $e);
  246. $e = preg_replace('| (\\w+?)=([^\\s>"]+)|si', " \$1=\"\$2\"", $e);
  247. if ((stristr($e,"href=") !== false) or (stristr($e,"src=") !== false) )
  248. {
  249. $regexp = '/ (href|src)="(.*?)"/i';
  250. preg_match($regexp,$e,$auxiliararray);
  251. $path = $auxiliararray[2];
  252. $path = str_replace("\\","/",$path); //If on Windows
  253. $regexp = '|^./|';
  254. $path = preg_replace($regexp,'',$path);
  255. if($path{0} != '#') //It is not an Internal Link
  256. {
  257. if (strpos($path,"../") !== false ) //It is a Relative Link
  258. {
  259. $backtrackamount = substr_count($path,"../");
  260. $maxbacktrack = substr_count($this->basepath,"/") - 1;
  261. $filepath = str_replace("../",'',$path);
  262. $path = $this->basepath;
  263. //If it is an invalid relative link, then make it go to directory root
  264. if ($backtrackamount > $maxbacktrack) $backtrackamount = $maxbacktrack;
  265. //Backtrack some directories
  266. for( $i = 0 ; $i < $backtrackamount + 1 ; $i++ ) $path = substr( $path, 0 , strrpos($path,"/") );
  267. $path = $path . "/" . $filepath; //Make it an absolute path
  268. }
  269. elseif( strpos($path,":/") === false) //It is a Local Link
  270. {
  271. $path = $this->basepath . $path;
  272. }
  273. }
  274. $e = preg_replace('/ (href|src)="(.*?)"/i',' \\1="'.$path.'"',$e);
  275. }
  276. $contents=array();
  277. preg_match_all('/\\S*=["\'][^"\']*["\']/',$e,$contents);
  278. preg_match('/\\S+/',$e,$a2);
  279. $tag=strtoupper($a2[0]);
  280. $attr=array();
  281. if (!empty($contents))
  282. {
  283. foreach($contents[0] as $v)
  284. {
  285. if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
  286. $attr[strtoupper($a3[1])]=$a3[2];
  287. }
  288. }
  289. $this->openTag($tag,$attr);
  290. }
  291. }
  292. }
  293. }
  294. private function openTag($tag,$attr)
  295. {
  296. $align = array('left'=>'L','center'=>'C','right'=>'R','top'=>'T','middle'=>'M','bottom'=>'B','justify'=>'J');
  297. $this->blockjustfinished=false;
  298. switch($tag)
  299. {
  300. case 'PAGE_BREAK':
  301. case 'NEWPAGE':
  302. $this->blockjustfinished = true;
  303. $this->addPage();
  304. break;
  305. case 'S':
  306. case 'STRIKE':
  307. case 'DEL':
  308. $this->strike=true;
  309. break;
  310. case 'SUB':
  311. $this->SUB=true;
  312. break;
  313. case 'SUP':
  314. $this->SUP=true;
  315. break;
  316. case 'TABLE':
  317. if ($this->x != $this->lMargin) $this->Ln($this->lineheight);
  318. $this->tablestart = true;
  319. $this->table['nc'] = $this->table['nr'] = 0;
  320. if (isset($attr['WIDTH'])) $this->table['w'] = $this->convertSize($attr['WIDTH'],$this->pgwidth);
  321. if (isset($attr['HEIGHT'])) $this->table['h'] = $this->convertSize($attr['HEIGHT'],$this->pgwidth);
  322. if (isset($attr['ALIGN'])) $this->table['a'] = $align[strtolower($attr['ALIGN'])];
  323. if (isset($attr['BORDER'])) $this->table['border'] = $attr['BORDER'];
  324. break;
  325. case 'TR':
  326. $this->row++;
  327. $this->table['nr']++;
  328. $this->col = -1;
  329. break;
  330. case 'TH':
  331. $this->setStyle('B',true);
  332. if (!isset($attr['ALIGN'])) $attr['ALIGN'] = "center";
  333. case 'TD':
  334. $this->tdbegin = true;
  335. $this->col++;
  336. while (isset($this->cell[$this->row][$this->col]))
  337. $this->col++;
  338. if ($this->table['nc'] < $this->col+1)
  339. $this->table['nc'] = $this->col+1;
  340. $this->cell[$this->row][$this->col] = array();
  341. $this->cell[$this->row][$this->col]['text'] = array();
  342. $this->cell[$this->row][$this->col]['s'] = 3;
  343. if (isset($attr['WIDTH'])) $this->cell[$this->row][$this->col]['w'] = $this->convertSize($attr['WIDTH'],$this->pgwidth);
  344. if (isset($attr['HEIGHT'])) $this->cell[$this->row][$this->col]['h'] = $this->convertSize($attr['HEIGHT'],$this->pgwidth);
  345. if (isset($attr['ALIGN'])) $this->cell[$this->row][$this->col]['a'] = $align[strtolower($attr['ALIGN'])];
  346. if (isset($attr['VALIGN'])) $this->cell[$this->row][$this->col]['va'] = $align[strtolower($attr['VALIGN'])];
  347. if (isset($attr['BORDER'])) $this->cell[$this->row][$this->col]['border'] = $attr['BORDER'];
  348. $cs = $rs = 1;
  349. if (isset($attr['COLSPAN']) && $attr['COLSPAN']>1) $cs = $this->cell[$this->row][$this->col]['colspan'] = $attr['COLSPAN'];
  350. if (isset($attr['ROWSPAN']) && $attr['ROWSPAN']>1) $rs = $this->cell[$this->row][$this->col]['rowspan'] = $attr['ROWSPAN'];
  351. for ($k=$this->row ; $k < $this->row+$rs ;$k++)
  352. {
  353. for($l=$this->col; $l < $this->col+$cs ;$l++)
  354. {
  355. if ($k-$this->row || $l-$this->col)
  356. $this->cell[$k][$l] = 0;
  357. }
  358. }
  359. if (isset($attr['NOWRAP'])) $this->cell[$this->row][$this->col]['nowrap']= 1;
  360. break;
  361. case 'OL':
  362. if (!isset($attr['TYPE']) or $attr['TYPE'] == '')
  363. $this->listtype = '1';
  364. else
  365. $this->listtype = $attr['TYPE'];
  366. case 'UL':
  367. if ((!isset($attr['TYPE']) or $attr['TYPE'] == '') and $tag=='UL')
  368. {
  369. //Insert UL defaults
  370. if ($this->listlvl == 0) $this->listtype = 'disc';
  371. elseif ($this->listlvl == 1) $this->listtype = 'circle';
  372. else $this->listtype = 'square';
  373. }
  374. elseif (isset($attr['TYPE']) and $tag=='UL') $this->listtype = $attr['TYPE'];
  375. $this->buffer_on = false;
  376. if ($this->listlvl == 0)
  377. {
  378. if (!$this->pjustfinished)
  379. {
  380. if ($this->x != $this->lMargin) $this->Ln($this->lineheight);
  381. $this->Ln($this->lineheight);
  382. }
  383. $this->oldx = $this->x;
  384. $this->listlvl++; // first depth level
  385. $this->listnum = 0; // reset
  386. $this->listoccur[$this->listlvl] = 1;
  387. $this->listlist[$this->listlvl][1] = array('TYPE'=>$this->listtype,'MAXNUM'=>$this->listnum);
  388. }
  389. else
  390. {
  391. if (!empty($this->textbuffer))
  392. {
  393. $this->listitem[] = array($this->listlvl,$this->listnum,$this->textbuffer,$this->listoccur[$this->listlvl]);
  394. $this->listnum++;
  395. }
  396. $this->textbuffer = array();
  397. $occur = $this->listoccur[$this->listlvl];
  398. $this->listlist[$this->listlvl][$occur]['MAXNUM'] = $this->listnum; //save previous lvl's maxnum
  399. $this->listlvl++;
  400. $this->listnum = 0; // reset
  401. if ($this->listoccur[$this->listlvl] == 0) $this->listoccur[$this->listlvl] = 1;
  402. else $this->listoccur[$this->listlvl]++;
  403. $occur = $this->listoccur[$this->listlvl];
  404. $this->listlist[$this->listlvl][$occur] = array('TYPE'=>$this->listtype,'MAXNUM'=>$this->listnum);
  405. }
  406. break;
  407. case 'LI':
  408. if ($this->listlvl == 0)
  409. {
  410. if (!$this->pjustfinished and $this->x != $this->lMargin) $this->Ln(2*$this->lineheight);
  411. $this->oldx = $this->x;
  412. $this->listlvl++; // first depth level
  413. $this->listnum = 0; // reset
  414. $this->listoccur[$this->listlvl] = 1;
  415. $this->listlist[$this->listlvl][1] = array('TYPE'=>'disc','MAXNUM'=>$this->listnum);
  416. }
  417. if ($this->listnum == 0)
  418. {
  419. $this->buffer_on = true; //activate list 'bufferization'
  420. $this->listnum++;
  421. $this->textbuffer = array();
  422. }
  423. else
  424. {
  425. $this->buffer_on = true; //activate list 'bufferization'
  426. if (!empty($this->textbuffer))
  427. {
  428. $this->listitem[] = array($this->listlvl,$this->listnum,$this->textbuffer,$this->listoccur[$this->listlvl]);
  429. $this->listnum++;
  430. }
  431. $this->textbuffer = array();
  432. }
  433. break;
  434. case 'H1': // 2 * fontsize
  435. case 'H2': // 1.5 * fontsize
  436. case 'H3': // 1.17 * fontsize
  437. case 'H4': // 1 * fontsize
  438. case 'H5': // 0.83 * fontsize
  439. case 'H6': // 0.67 * fontsize
  440. $this->buffer_on = true;
  441. if ($this->x != $this->lMargin) $this->Ln(2*$this->lineheight);
  442. elseif (!$this->pjustfinished) $this->Ln($this->lineheight);
  443. $this->setStyle('B',true);
  444. switch($tag)
  445. {
  446. case 'H1':
  447. $this->setFontSize(2*$this->FontSizePt);
  448. $this->lineheight *= 2;
  449. break;
  450. case 'H2':
  451. $this->setFontSize(1.5*$this->FontSizePt);
  452. $this->lineheight *= 1.5;
  453. break;
  454. case 'H3':
  455. $this->setFontSize(1.17*$this->FontSizePt);
  456. $this->lineheight *= 1.17;
  457. break;
  458. case 'H4':
  459. $this->setFontSize($this->FontSizePt);
  460. break;
  461. case 'H5':
  462. $this->setFontSize(0.83*$this->FontSizePt);
  463. $this->lineheight *= 0.83;
  464. break;
  465. case 'H6':
  466. $this->setFontSize(0.67*$this->FontSizePt);
  467. $this->lineheight *= 0.67;
  468. break;
  469. }
  470. break;
  471. case 'HR':
  472. if ($this->x != $this->lMargin) $this->Ln($this->lineheight);
  473. $this->Ln(0.2*$this->lineheight);
  474. $hrwidth = $this->pgwidth;
  475. $this->setDrawColor(200, 200, 200);
  476. $x = $this->x;
  477. $y = $this->y;
  478. $empty = $this->pgwidth - $hrwidth;
  479. $empty /= 2;
  480. $x += $empty;
  481. $oldlinewidth = $this->LineWidth;
  482. $this->setLineWidth(0.3);
  483. $this->Line($x,$y,$x+$hrwidth,$y);
  484. $this->setLineWidth($oldlinewidth);
  485. $this->Ln(0.2*$this->lineheight);
  486. $this->setDrawColor(0);
  487. $this->blockjustfinished = true; //Eliminate exceeding left-side spaces
  488. break;
  489. case 'INS':
  490. $this->setStyle('U',true);
  491. break;
  492. case 'TITLE':
  493. $this->titulo = true;
  494. break;
  495. case 'B':
  496. case 'I':
  497. case 'U':
  498. if( isset($attr['CLASS']) or isset($attr['ID']) or isset($attr['STYLE']) )
  499. {
  500. $this->cssbegin=true;
  501. if (isset($attr['CLASS'])) $properties = $this->CSS[$attr['CLASS']];
  502. elseif (isset($attr['ID'])) $properties = $this->CSS[$attr['ID']];
  503. //Read Inline CSS
  504. if (isset($attr['STYLE'])) $properties = $this->readInlineCSS($attr['STYLE']);
  505. //Look for name in the $this->CSS array
  506. $this->backupcss = $properties;
  507. if (!empty($properties)) $this->setCSS($properties); //name found in the CSS array!
  508. }
  509. $this->setStyle($tag,true);
  510. break;
  511. case 'A':
  512. if (isset($attr['NAME']) and $attr['NAME'] != '')
  513. $this->textbuffer[] = array('','','',array(),'',false,false,$attr['NAME']); //an internal link (adds a space for recognition)
  514. break;
  515. case 'DIV':
  516. if ($this->listlvl > 0) // We are closing (omitted) OL/UL tag(s)
  517. {
  518. $this->buffer_on = false;
  519. if (!empty($this->textbuffer)) $this->listitem[] = array($this->listlvl,$this->listnum,$this->textbuffer,$this->listoccur[$this->listlvl]);
  520. $this->textbuffer = array();
  521. $this->listlvl--;
  522. $this->printlistbuffer();
  523. $this->pjustfinished = true; //act as if a paragraph just ended
  524. }
  525. $this->divSettings->setValue("divbegin", true);
  526. if ($this->x != $this->lMargin) $this->Ln($this->lineheight);
  527. if( isset($attr['CLASS']) or isset($attr['ID']) or isset($attr['STYLE']) )
  528. {
  529. $this->cssbegin=true;
  530. if (isset($attr['CLASS'])) $properties = $this->CSS[$attr['CLASS']];
  531. elseif (isset($attr['ID'])) $properties = $this->CSS[$attr['ID']];
  532. //Read Inline CSS
  533. if (isset($attr['STYLE'])) $properties = $this->readInlineCSS($attr['STYLE']);
  534. //Look for name in the $this->CSS array
  535. if (!empty($properties)) $this->setCSS($properties); //name found in the CSS array!
  536. }
  537. break;
  538. case 'IMG':
  539. if(!empty($this->textbuffer) and !$this->tablestart)
  540. {
  541. $olddivwidth = $this->divSettings->getValue("divwidth");
  542. $olddivheight = $this->divSettings->getValue("divheight");
  543. if ( $olddivwidth == 0) $this->divwidth = $this->pgwidth - $x + $this->lMargin;
  544. if ( $olddivheight == 0) $this->divheight = $this->lineheight;
  545. //Print content
  546. $this->printbuffer($this->textbuffer,true/*is out of a block (e.g. DIV,P etc.)*/);
  547. $this->textbuffer=array();
  548. $this->divSettings->setValue("divwidth", $olddivwidth);
  549. $this->divSettings->setValue("divheight", $olddivheight);
  550. $this->textbuffer=array();
  551. $this->Ln($this->lineheight);
  552. }
  553. if(isset($attr['SRC']))
  554. {
  555. $srcpath = $attr['SRC'];
  556. if(!isset($attr['WIDTH'])) $attr['WIDTH'] = 0;
  557. else $attr['WIDTH'] = $this->convertSize($attr['WIDTH'],$this->pgwidth);//$attr['WIDTH'] /= 4;
  558. if(!isset($attr['HEIGHT'])) $attr['HEIGHT'] = 0;
  559. else $attr['HEIGHT'] = $this->convertSize($attr['HEIGHT'],$this->pgwidth);//$attr['HEIGHT'] /= 4;
  560. if ($this->tdbegin)
  561. {
  562. $bak_x = $this->x;
  563. $bak_y = $this->y;
  564. $f_exists = @fopen($srcpath,"rb");
  565. if (!$f_exists)
  566. break;
  567. $sizesarray = $this->Image($srcpath, $this->GetX(), $this->GetY(), $attr['WIDTH'], $attr['HEIGHT'],'','',false);
  568. $this->y = $bak_y;
  569. $this->x = $bak_x;
  570. }
  571. elseif($this->pbegin or $this->divSettings->getValue("divbegin"))
  572. {
  573. $ypos = 0;
  574. $bak_x = $this->x;
  575. $bak_y = $this->y;
  576. $f_exists = @fopen($srcpath,"rb");
  577. if (!$f_exists)
  578. break;
  579. $sizesarray = $this->Image($srcpath, $this->GetX(), $this->GetY(), $attr['WIDTH'], $attr['HEIGHT'],'','',false);
  580. $this->y = $bak_y;
  581. $this->x = $bak_x;
  582. $xpos = '';
  583. switch($this->divalign)
  584. {
  585. case "C":
  586. $spacesize = $this->CurrentFont[ 'cw' ][ ' ' ] * ( $this->FontSizePt / 1000 );
  587. $empty = ($this->pgwidth - $sizesarray['WIDTH'])/2;
  588. $xpos = 'xpos='.$empty.',';
  589. break;
  590. case "R":
  591. $spacesize = $this->CurrentFont[ 'cw' ][ ' ' ] * ( $this->FontSizePt / 1000 );
  592. $empty = ($this->pgwidth - $sizesarray['WIDTH']);
  593. $xpos = 'xpos='.$empty.',';
  594. break;
  595. default: break;
  596. }
  597. $numberoflines = (integer)ceil($sizesarray['HEIGHT']/$this->lineheight) ;
  598. $ypos = $numberoflines * $this->lineheight;
  599. $this->textbuffer[] = array("»¤¬"/*identifier*/."type=image,ypos=$ypos,{$xpos}width=".$sizesarray['WIDTH'].",height=".$sizesarray['HEIGHT']."»¤¬".$sizesarray['OUTPUT']);
  600. while($numberoflines)
  601. {
  602. $this->textbuffer[] = array("\n", '' ,$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);$numberoflines--;
  603. }
  604. }
  605. else
  606. {
  607. $imgborder = 0;
  608. if (isset($attr['BORDER'])) $imgborder = $this->convertSize($attr['BORDER'],$this->pgwidth);
  609. $f_exists = @fopen($srcpath,"rb");
  610. if (!$f_exists) //Show 'image not found' icon instead
  611. {
  612. $srcpath = str_replace("\\","/",dirname(__FILE__)) . "/";
  613. $srcpath .= 'no_img.gif';
  614. }
  615. $sizesarray = $this->Image($srcpath, $this->GetX(), $this->GetY(), $attr['WIDTH'], $attr['HEIGHT'],'', ''); //Output Image
  616. $ini_x = $sizesarray['X'];
  617. $ini_y = $sizesarray['Y'];
  618. if ($imgborder)
  619. {
  620. $oldlinewidth = $this->LineWidth;
  621. $this->setLineWidth($imgborder);
  622. $this->Rect($ini_x,$ini_y,$sizesarray['WIDTH'],$sizesarray['HEIGHT']);
  623. $this->setLineWidth($oldlinewidth);
  624. }
  625. }
  626. if ($sizesarray['X'] < $this->x) $this->x = $this->lMargin;
  627. if ($this->tablestart)
  628. {
  629. $this->cell[$this->row][$this->col]['textbuffer'][] = array("»¤¬"/*identifier*/."type=image,width=".$sizesarray['WIDTH'].",height=".$sizesarray['HEIGHT']."»¤¬".$sizesarray['OUTPUT']);
  630. $this->cell[$this->row][$this->col]['s'] += $sizesarray['WIDTH'] + 1;// +1 == margin
  631. $this->cell[$this->row][$this->col]['form'] = true; // in order to make some width adjustments later
  632. if (!isset($this->cell[$this->row][$this->col]['w'])) $this->cell[$this->row][$this->col]['w'] = $sizesarray['WIDTH'] + 3;
  633. if (!isset($this->cell[$this->row][$this->col]['h'])) $this->cell[$this->row][$this->col]['h'] = $sizesarray['HEIGHT'] + 3;
  634. }
  635. }
  636. break;
  637. case 'BLOCKQUOTE':
  638. case 'BR':
  639. if($this->tablestart)
  640. {
  641. $this->cell[$this->row][$this->col]['textbuffer'][] = array("\n", '',$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);
  642. $this->cell[$this->row][$this->col]['text'][] = "\n";
  643. if (!isset($this->cell[$this->row][$this->col]['maxs'])) $this->cell[$this->row][$this->col]['maxs'] = $this->cell[$this->row][$this->col]['s'] +2; //+2 == margin
  644. elseif($this->cell[$this->row][$this->col]['maxs'] < $this->cell[$this->row][$this->col]['s']) $this->cell[$this->row][$this->col]['maxs'] = $this->cell[$this->row][$this->col]['s']+2;//+2 == margin
  645. $this->cell[$this->row][$this->col]['s'] = 0;// reset
  646. }
  647. elseif($this->divSettings->getValue("divbegin") or $this->pbegin or $this->buffer_on) $this->textbuffer[] = array("\n", '',$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);
  648. else {$this->Ln($this->lineheight);$this->blockjustfinished = true;}
  649. break;
  650. case 'P':
  651. //in case of malformed HTML code. Example:(...)</p><li>Content</li><p>Paragraph1</p>(...)
  652. if ($this->listlvl > 0) // We are closing (omitted) OL/UL tag(s)
  653. {
  654. $this->buffer_on = false;
  655. if (!empty($this->textbuffer)) $this->listitem[] = array($this->listlvl,$this->listnum,$this->textbuffer,$this->listoccur[$this->listlvl]);
  656. $this->textbuffer = array();
  657. $this->listlvl--;
  658. $this->printlistbuffer();
  659. $this->pjustfinished = true; //act as if a paragraph just ended
  660. }
  661. if ($this->tablestart)
  662. {
  663. $this->cell[$this->row][$this->col]['textbuffer'][] = array($e, '',$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);
  664. $this->cell[$this->row][$this->col]['text'][] = "\n";
  665. break;
  666. }
  667. $this->pbegin=true;
  668. if ($this->x != $this->lMargin) $this->Ln(2*$this->lineheight);
  669. elseif (!$this->pjustfinished) $this->Ln($this->lineheight);
  670. //Save x,y coords in case we need to print borders...
  671. $this->oldx = $this->x;
  672. $this->oldy = $this->y;
  673. if(isset($attr['CLASS']) or isset($attr['ID']) or isset($attr['STYLE']) )
  674. {
  675. $this->cssbegin=true;
  676. if (isset($attr['CLASS'])) $properties = $this->CSS[$attr['CLASS']];
  677. elseif (isset($attr['ID'])) $properties = $this->CSS[$attr['ID']];
  678. //Read Inline CSS
  679. if (isset($attr['STYLE'])) $properties = $this->readInlineCSS($attr['STYLE']);
  680. $this->backupcss = $properties;
  681. if (!empty($properties)) $this->setCSS($properties); //name(id/class/style) found in the CSS array!
  682. }
  683. break;
  684. case 'SPAN':
  685. $this->buffer_on = true;
  686. //Save x,y coords in case we need to print borders...
  687. $this->oldx = $this->x;
  688. $this->oldy = $this->y;
  689. if( isset($attr['CLASS']) or isset($attr['ID']) or isset($attr['STYLE']) )
  690. {
  691. $this->cssbegin=true;
  692. if (isset($attr['CLASS'])) $properties = $this->CSS[$attr['CLASS']];
  693. elseif (isset($attr['ID'])) $properties = $this->CSS[$attr['ID']];
  694. //Read Inline CSS
  695. if (isset($attr['STYLE'])) $properties = $this->readInlineCSS($attr['STYLE']);
  696. //Look for name in the $this->CSS array
  697. $this->backupcss = $properties;
  698. if (!empty($properties)) $this->setCSS($properties); //name found in the CSS array!
  699. }
  700. break;
  701. case 'PRE':
  702. if($this->tablestart)
  703. {
  704. $this->cell[$this->row][$this->col]['textbuffer'][] = array("\n", '',$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);
  705. $this->cell[$this->row][$this->col]['text'][] = "\n";
  706. }
  707. elseif($this->divSettings->getValue("divbegin") or $this->pbegin or $this->buffer_on) $this->textbuffer[] = array("\n", '',$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);
  708. else
  709. {
  710. if ($this->x != $this->lMargin) $this->Ln(2*$this->lineheight);
  711. elseif (!$this->pjustfinished) $this->Ln($this->lineheight);
  712. $this->buffer_on = true;
  713. $this->oldx = $this->x;
  714. $this->oldy = $this->y;
  715. if(isset($attr['CLASS']) or isset($attr['ID']) or isset($attr['STYLE']) )
  716. {
  717. $this->cssbegin=true;
  718. if (isset($attr['CLASS'])) $properties = $this->CSS[$attr['CLASS']];
  719. elseif (isset($attr['ID'])) $properties = $this->CSS[$attr['ID']];
  720. //Read Inline CSS
  721. if (isset($attr['STYLE'])) $properties = $this->readInlineCSS($attr['STYLE']);
  722. //Look for name in the $this->CSS array
  723. $this->backupcss = $properties;
  724. if (!empty($properties)) $this->setCSS($properties); //name(id/class/style) found in the CSS array!
  725. }
  726. }
  727. case 'CODE':
  728. $this->setFont('courier');
  729. $this->currentfont='courier';
  730. break;
  731. case 'TEXTAREA':
  732. $this->buffer_on = true;
  733. $colsize = 20; //HTML default value
  734. $rowsize = 2; //HTML default value
  735. if (isset($attr['COLS'])) $colsize = $attr['COLS'];
  736. if (isset($attr['ROWS'])) $rowsize = $attr['ROWS'];
  737. if (!$this->tablestart)
  738. {
  739. if ($this->x != $this->lMargin) $this->Ln($this->lineheight);
  740. $this->col = $colsize;
  741. $this->row = $rowsize;
  742. }
  743. else //it is inside a table
  744. {
  745. $this->specialcontent = "type=textarea,lines=$rowsize,width=".((2.2*$colsize) + 3); //Activate form info in order to paint FORM elements within table
  746. $this->cell[$this->row][$this->col]['s'] += (2.2*$colsize) + 6;// +6 == margin
  747. if (!isset($this->cell[$this->row][$this->col]['h'])) $this->cell[$this->row][$this->col]['h'] = 1.1*$this->lineheight*$rowsize + 2.5;
  748. }
  749. break;
  750. case 'SELECT':
  751. $this->specialcontent = "type=select"; //Activate form info in order to paint FORM elements within table
  752. break;
  753. case 'OPTION':
  754. $this->selectoption['ACTIVE'] = true;
  755. if (empty($this->selectoption))
  756. {
  757. $this->selectoption['MAXWIDTH'] = '';
  758. $this->selectoption['SELECTED'] = '';
  759. }
  760. if (isset($attr['SELECTED'])) $this->selectoption['SELECTED'] = '';
  761. break;
  762. case 'FORM':
  763. if($this->tablestart)
  764. {
  765. $this->cell[$this->row][$this->col]['textbuffer'][] = array($e, '',$this->currentstyle,$this->colorarray,$this->currentfont,$this->SUP,$this->SUB,''/*internal link*/,$this->strike,$this->outlineparam,$this->bgcolorarray);
  766. $this->cell[$this->row][$this->col]['text'][] = "\n";
  767. }
  768. elseif ($this->x != $this->lMargin) $this->Ln($this->lineheight); //Skip a line, if needed
  769. break;
  770. case 'INPUT':
  771. if (!isset($attr['TYPE'])) $attr['TYPE'] == ''; //in order to allow default 'TEXT' form (in case of malformed HTML code)
  772. if (!$this->tablestart)
  773. {
  774. switch(strtoupper($attr['TYPE'])){
  775. case 'CHECKBOX': //Draw Checkbox
  776. $checked = false;
  777. if (isset($attr['CHECKED'])) $checked = true;
  778. $this->setFillColor(235,235,235);
  779. $this->x += 3;
  780. $this->Rect($this->x,$this->y+1,3,3,'DF');
  781. if ($checked)
  782. {
  783. $this->Line($this->x,$this->y+1,$this->x+3,$this->y+1+3);
  784. $this->Line($this->x,$this->y+1+3,$this->x+3,$this->y+1);
  785. }
  786. $this->setFillColor(255);
  787. $this->x += 3.5;
  788. break;
  789. case 'RADIO': //Draw Radio button
  790. $checked = false;
  791. if (isset($attr['CHECKED'])) $checked = true;
  792. $this->x += 4;
  793. $this->Circle($this->x,$this->y+2.2,1,'D');
  794. $this->_out('0.000 g');
  795. if ($checked) $this->Circle($this->x,$this->y+2.2,0.4,'DF');
  796. $this->Write(5,$texto,$this->x);
  797. $this->x += 2;
  798. break;
  799. case 'BUTTON':
  800. case 'SUBMIT':
  801. case 'RESET':
  802. $texto='';
  803. if (isset($attr['VALUE'])) $texto = $attr['VALUE'];
  804. $nihil = 2.5;
  805. $this->x += 2;
  806. $this->setFillColor(190,190,190);
  807. $this->Rect($this->x,$this->y,$this->GetStringWidth($texto)+2*$nihil,4.5,'DF'); // 4.5 in order to avoid overlapping
  808. $this->x += $nihil;
  809. $this->Write(5,$texto,$this->x);
  810. $this->x += $nihil;
  811. $this->setFillColor(255);
  812. break;
  813. case 'PASSWORD':
  814. if (isset($attr['VALUE']))
  815. {
  816. $num_stars = strlen($attr['VALUE']);
  817. $attr['VALUE'] = str_repeat('*',$num_stars);
  818. }
  819. case 'TEXT': //Draw TextField
  820. default: //default == TEXT
  821. $texto='';
  822. if (isset($attr['VALUE'])) $texto = $attr['VALUE'];
  823. $tamanho = 20;
  824. if (isset($attr['SIZE']) and ctype_digit($attr['SIZE']) ) $tamanho = $attr['SIZE'];
  825. $this->setFillColor(235,235,235);
  826. $this->x += 2;
  827. $this->Rect($this->x,$this->y,2*$tamanho,4.5,'DF');// 4.5 in order to avoid overlapping
  828. if ($texto != '')
  829. {
  830. $this->x += 1;
  831. $this->Write(5,$texto,$this->x);
  832. $this->x -= $this->GetStringWidth($texto);
  833. }
  834. $this->setFillColor(255);
  835. $this->x += 2*$tamanho;
  836. break;
  837. }
  838. }
  839. else //we are inside a table
  840. {
  841. $this->cell[$this->row][$this->col]['form'] = true; // in order to make some width adjustments later
  842. $type = '';
  843. $text = '';
  844. $height = 0;
  845. $width = 0;
  846. switch(strtoupper($attr['TYPE'])){
  847. case 'CHECKBOX': //Draw Checkbox
  848. $checked = false;
  849. if (isset($attr['CHECKED'])) $checked = true;
  850. $text = $checked;
  851. $type = 'CHECKBOX';
  852. $width = 4;
  853. $this->cell[$this->row][$this->col]['textbuffer'][] = array("»¤¬"/*identifier*/."type=input,subtype=$type,width=$width,height=$height"."»¤¬".$text);
  854. $this->cell[$this->row][$this->col]['s'] += $width;
  855. if (!isset($this->cell[$this->row][$this->col]['h'])) $this->cell[$this->row][$this->col]['h'] = $this->lineheight;
  856. break;
  857. case 'RADIO': //Draw Radio button
  858. $checked = false;
  859. if (isset($attr['CHECKED'])) $checked = true;
  860. $text = $checked;
  861. $type = 'RADIO';
  862. $width = 3;
  863. $this->cell[$this->row][$this->col]['textbuffer'][] = array("»¤¬"/*identifier*/."type=input,subtype=$type,width=$width,height=$height"."»¤¬".$text);
  864. $this->cell[$this->row][$this->col]['s'] += $width;
  865. if (!isset($this->cell[$this->row][$this->col]['h'])) $this->cell[$this->row][$this->col]['h'] = $this->lineheight;
  866. break;
  867. case 'BUTTON': $type = 'BUTTON'; // Draw a button
  868. case 'SUBMIT': if ($type == '') $type = 'SUBMIT';
  869. case 'RESET': if ($type == '') $type = 'RESET';
  870. $texto='';
  871. if (isset($attr['VALUE'])) $texto = " " . $attr['VALUE'] . " ";
  872. $text = $texto;
  873. $width = $this->GetStringWidth($texto)+3;
  874. $this->cell[$this->row][$this->col]['textbuffer'][] = array("»¤¬"/*identifier*/."type=input,subtype=$type,width=$width,height=$height"."»¤¬".$text);
  875. $this->cell[$this->row][$this->col]['s'] += $width;
  876. if (!isset($this->cell[$this->row][$this->col]['h'])) $this->cell[$this->row][$this->col]['h'] = $this->lineheight + 2;
  877. break;
  878. case 'PASSWORD':
  879. if (isset($attr['VALUE']))
  880. {
  881. $num_stars = strlen($attr['VALUE']);
  882. $attr['VALUE'] = str_repeat('*',$num_stars);
  883. }
  884. $type = 'PASSWORD';
  885. case 'TEXT': //Draw TextField
  886. default: //default == TEXT
  887. $texto='';
  888. if (isset($attr['VALUE'])) $texto = $attr['VALUE'];
  889. $tamanho = 20;
  890. if (isset($attr['SIZE']) and ctype_digit($attr['SIZE']) ) $tamanho = $attr['SIZE'];
  891. $text = $texto;
  892. $width = 2*$tamanho;
  893. if ($type == '') $type = 'TEXT';
  894. $this->cell[$this->row][$this->col]['textbuffer'][] = array("»¤¬"/*identifier*/."type=input,subtype=$type,width=$width,height=$height"."»¤¬".$text);
  895. $this->cell[$this->row][$this->col]['s'] += $width;
  896. if (!isset($this->cell[$this->row][$this->col]['h'])) $this->cell[$this->row][$this->col]['h'] = $this->lineheight + 2;
  897. break;
  898. }
  899. }
  900. break;
  901. }
  902. $this->pjustfinished=false;
  903. }
  904. function CloseTag($tag)
  905. {
  906. if($tag=='OPTION') $this->selectoption['ACTIVE'] = false;
  907. if($tag=='INS') $tag='U';
  908. if($tag=='STRONG') $tag='B';
  909. if($tag=='EM' or $tag=='CITE') $tag='I';
  910. if($tag=='OUTLINE')
  911. {
  912. if(!$this->pbegin and !$this->divSettings->getValue("divbegin") and !$this->tablestart)
  913. {
  914. $this->setTextOutline(false);
  915. $this->outlineparam=array();
  916. //Save x,y coords ???
  917. $x = $this->x;
  918. $y = $this->y;
  919. //Set some default values
  920. $this->divSettings->setValue("divwidth", $this->pgwidth - $x + $this->lMargin);
  921. //Print content
  922. $this->printbuffer($this->textbuffer,true/*is out of a block (e.g. DIV,P etc.)*/);
  923. $this->textbuffer=array();
  924. //Reset values
  925. $this->Reset();
  926. $this->buffer_on=false;
  927. }
  928. $this->setTextOutline(false);
  929. $this->outlineparam=array();
  930. }
  931. if($tag=='A')
  932. {
  933. if(!$this->pbegin and !$this->divSettings->getValue("divbegin") and !$this->tablestart and !$this->buffer_on)
  934. {
  935. //Save x,y coords ???
  936. $x = $this->x;
  937. $y = $this->y;
  938. //Set some default values
  939. $this->divSettings->setValue("divwidth", $this->pgwidth - $x + $this->lMargin);
  940. //Print content
  941. $this->printbuffer($this->textbuffer,true/*is out of a block (e.g. DIV,P etc.)*/);
  942. $this->textbuffer=array();
  943. //Reset values
  944. $this->Reset();
  945. }
  946. }
  947. if($tag=='TH') $this->setStyle('B',false);
  948. if($tag=='TH' or $tag=='TD') $this->tdbegin = false;
  949. if($tag=='SPAN')
  950. {
  951. if(!$this->pbegin and !$this->divSettings->getValue("divbegin") and !$this->tablestart)
  952. {
  953. if($this->cssbegin)
  954. {
  955. //Check if we have borders to print
  956. if ($this->cssbegin and ($this->divborder or $this->dash_on or $this->dotted_on or $this->divbgcolor))
  957. {
  958. $texto='';
  959. foreach($this->textbuffer as $vetor) $texto.=$vetor[0];
  960. $tempx = $this->x;
  961. if($this->divbgcolor) $this->Cell($this->GetStringWidth($texto),$this->lineheight,'',$this->divborder,'','L',$this->divbgcolor);
  962. if ($this->dash_on) $this->Rect($this->oldx,$this->oldy,$this->GetStringWidth($texto),$this->lineheight);
  963. if ($this->dotted_on) $this->DottedRect($this->x - $this->GetStringWidth($texto),$this->y,$this->GetStringWidth($texto),$this->lineheight);
  964. $this->x = $tempx;
  965. $this->x -= 1; //adjust alignment
  966. }
  967. $this->cssbegin=false;
  968. $this->backupcss=array();
  969. }
  970. //Save x,y coords ???
  971. $x = $this->x;
  972. $y = $this->y;
  973. //Set some default values
  974. $this->divSettings->setValue("divwidth", $this->pgwidth - $x + $this->lMargin);
  975. //Print content
  976. $this->printbuffer($this->textbuffer,true/*is out of a block (e.g. DIV,P etc.)*/);
  977. $this->textbuffer=array();
  978. //Reset values
  979. $this->Reset();
  980. }
  981. $this->buffer_on=false;
  982. }
  983. if($tag=='P' or $tag=='DIV') //CSS in BLOCK mode
  984. {
  985. $this->blockjustfinished = true; //Eliminate exceeding left-side spaces
  986. if(!$this->tablestart)
  987. {
  988. if ($this->divSettings->getValue("divwidth") == 0) $this->divSettings->setValue("divwidth", $this->pgwidth);
  989. if ($tag=='P')
  990. {
  991. $this->pbegin=false;
  992. $this->pjustfinished=true;
  993. }
  994. else $this->divSettings->setValue("divbegin", false);
  995. $content='';
  996. foreach($this->textbuffer as $aux) $content .= $aux[0];
  997. $numlines = $this->WordWrap($content, $this->divSettings->getValue("divwidth"));
  998. if ($this->divheight == 0) $this->divheight = $numlines * 5;
  999. //Print content
  1000. $this->printbuffer($this->textbuffer);
  1001. $this->textbuffer=array();
  1002. if ($tag=='P') $this->Ln($this->lineheight);
  1003. }//end of 'if (!this->tablestart)'
  1004. //Reset values
  1005. $this->Reset();
  1006. $this->cssbegin=false;
  1007. $this->backupcss=array();
  1008. }
  1009. if($tag=='TABLE') { // TABLE-END
  1010. $this->blockjustfinished = true; //Eliminate exceeding left-side spaces
  1011. $this->table['cells'] = $this->cell;
  1012. $this->table['wc'] = array_pad(array(),$this->table['nc'],array('miw'=>0,'maw'=>0));
  1013. $this->table['hr'] = array_pad(array(),$this->table['nr'],0);
  1014. $this->_tableColumnWidth($this->table);
  1015. $this->_tableWidth($this->table);
  1016. $this->_tableHeight($this->table);
  1017. $this->_tableWrite($this->table);
  1018. //Reset values
  1019. $this->tablestart=false; //bool
  1020. $this->table=array(); //array
  1021. $this->cell=array(); //array
  1022. $this->col=-1; //int
  1023. $this->row=-1; //int
  1024. $this->Reset();
  1025. $this->Ln(0.5*$this->lineheight);
  1026. }
  1027. if(($tag=='UL') or ($tag=='OL')) {
  1028. if ($this->buffer_on == false) $this->listnum--;
  1029. if ($this->listlvl == 1) // We are…

Large files files are truncated, but you can click here to view the full file