示例#1
0
 /**
  * Write the current table
  */
 public function writeTable()
 {
     $table = 0;
     //initialize table with 0
     foreach ($this->currentTable as $rowId => $columns) {
         foreach ($columns as $columnId => $text) {
             $fontType = $rowId == 1 ? 'th' : 'td';
             $textFlow = $this->pdf->add_textflow(0, $text, $this->fontOptions($fontType));
             $table = $this->pdf->add_table_cell($table, $columnId + 1, $rowId, '', "rowheight={$this->fonts[$fontType]['rowheight']} fittextflow={verticalalign=top} textflow={$textFlow} margin=1");
         }
     }
     if ($table) {
         do {
             $continue = false;
             //If we are closer that one header row from the bottom of the page then create a new page and then place the table
             if ($this->fonts['th']['rowheight'] > $this->currentY - 50) {
                 //TOO CLOSE
                 $this->newPage();
             }
             $return = $this->pdf->fit_table($table, 25, 25, $this->pageWidth - 20, $this->currentY, 'stroke={{line=other}}');
             if ($return == '_boxfull') {
                 $this->newPage();
                 $continue = true;
             }
         } while ($continue);
         $height = $this->pdf->info_table($table, 'height');
         $this->currentY = $this->currentY - $height;
         if ($this->currentY < 25) {
             $this->newPage();
         }
         $this->pdf->delete_table($table, '');
         $this->currentTable = array();
         $this->tableRow = false;
     }
 }