function table_resize_row($height, $top)
 {
     // Do cell vertical-align
     // Calculate row baseline
     $baseline = $this->get_row_baseline();
     // Process cells contained in current row
     for ($i = 0; $i < count($this->content); $i++) {
         $cell =& $this->content[$i];
         // Offset cell if needed
         $cell->offset(0, $top - $cell->get_top_margin());
         // Vertical-align cell (do not apply to rowspans)
         if ($cell->rowspan == 1) {
             $va_fun = CSSVerticalAlign::value2pdf($cell->vertical_align);
             $va_fun->apply_cell($cell, $height, $baseline);
             // Expand cell to full row height
             $cell->put_full_height($height);
         }
     }
 }
 function reflow(&$driver, &$media, $boxes)
 {
     $context = new FlowContext();
     $this->_position($media, $boxes, $context);
     $this->setCSSProperty(CSS_WIDTH, new WCConstant($this->get_width()));
     $this->put_height_constraint(new HCConstraint(array($this->height, false), null, null));
     $this->reflow_content($context);
     /**
      * Apply vertical-align (behave like table cell)
      */
     $va = CSSVerticalAlign::value2pdf($this->get_css_property(CSS_VERTICAL_ALIGN));
     $va->apply_cell($this, $this->get_full_height(), 0);
 }
 function table_fit_rowspans($heights)
 {
     $spans = $this->get_rowspans();
     // Scan all cells spanning several rows
     foreach ($spans as $span) {
         $cell =& $this->content[$span->row]->content[$span->column];
         // now check if cell height is less than sum of spanned rows heights
         $row_heights = array_slice($heights, $span->row, $span->size);
         // Vertical-align current cell
         // calculate (approximate) row baseline
         $baseline = $this->content[$span->row]->get_row_baseline();
         // apply vertical-align
         $vertical_align = $cell->getCSSProperty(CSS_VERTICAL_ALIGN);
         $va_fun = CSSVerticalAlign::value2pdf($vertical_align);
         $va_fun->apply_cell($cell, array_sum($row_heights), $baseline);
         if (array_sum($row_heights) > $cell->get_full_height()) {
             // Make cell fill all available vertical space
             $cell->put_full_height(array_sum($row_heights));
         }
     }
 }