Пример #1
0
 public function setStyle()
 {
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $style->setFillColor(new Zend_Pdf_Color_Html('#333333'));
     $style->setLineColor(new Zend_Pdf_Color_Html('#990033'));
     $style->setLineWidth(1);
     $this->_page->setStyle($style);
 }
Пример #2
0
 public function __construct($labels = array())
 {
     $cols = null;
     foreach ($labels as $label) {
         $col = new Core_Pdf_Table_Column();
         $col->setText($label);
         $cols[] = $col;
     }
     if ($cols) {
         $this->setColumns($cols);
     }
     //set default alignment
     $this->_align = Core_Pdf::CENTER;
     //set default borders
     $style = new Zend_Pdf_Style();
     $style->setLineWidth(2);
     $this->setBorder(Core_Pdf::BOTTOM, $style);
     $this->setCellPaddings(array(5, 5, 5, 5));
     //set default font
     $this->_font = Zend_Pdf_Font::fontWithName(ZEND_Pdf_Font::FONT_HELVETICA_BOLD);
     $this->_fontSize = 12;
 }
Пример #3
0
        }
    } else {
        // Throw an exception if it's not the "Can't open file" exception
        throw $e;
    }
}

//------------------------------------------------------------------------------------
// Reverse page order
$pdf->pages = array_reverse($pdf->pages);

// Create new Style
$style = new Zend_Pdf_Style();
$style->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0.9));
$style->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
$style->setLineWidth(3);
$style->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
$style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 32);

try {
    // Create new image object
    require_once 'Zend/Pdf/Image.php';
    $stampImage = Zend_Pdf_Image::imageWithPath(__DIR__ . '/stamp.jpg');
} catch (Zend_Pdf_Exception $e) {
    // Example of operating with image loading exceptions.
    if ($e->getMessage() != 'Image extension is not installed.' &&
        $e->getMessage() != 'JPG support is not configured properly.') {
        throw $e;
    }
    $stampImage = null;
}
 private function drawGeneralLayout()
 {
     $recstyle = new Zend_Pdf_Style();
     $recstyle->setLineWidth(0.5);
     $this->page->setStyle($recstyle);
     $this->page->drawRoundedRectangle($this->coordX(0), $this->coordY(0) - $this->mmToPts(150), $this->coordX(0) + $this->mmToPts(100), $this->coordY(0), $radius = array(15, 15, 15, 15), $fillType = Zend_Pdf_Page::SHAPE_DRAW_STROKE);
     //General GLS-Layout
     //x-achse | y-Achse | Länge | Dicke
     $ControlBar1 = array('x' => 1, 'y' => 2, 'length' => 98, 'thick' => 1, 'horizontal' => true);
     $ControlBar2 = array('x' => 1, 'y' => 15, 'length' => 98, 'thick' => 0.5, 'horizontal' => true);
     $ControlBar3 = array('x' => 1, 'y' => 27.5, 'length' => 98, 'thick' => 0.5, 'horizontal' => true);
     $ControlBar4 = array('x' => 1, 'y' => 56, 'length' => 98, 'thick' => 0.5, 'horizontal' => true);
     $Line1 = array('x' => 1, 'y' => 62.5, 'length' => 98, 'thick' => 0.25, 'horizontal' => true);
     $Line2 = array('x' => 1, 'y' => 90, 'length' => 81.5, 'thick' => 0.25, 'horizontal' => true);
     $Line3 = array('x' => 1, 'y' => 119, 'length' => 81.5, 'thick' => 0.25, 'horizontal' => true);
     $Line4 = array('x' => 1, 'y' => 134.5, 'length' => 98, 'thick' => 0.25, 'horizontal' => true);
     $Line5 = array('x' => 1, 'y' => 62.5, 'length' => 72, 'thick' => 0.25, 'horizontal' => false);
     $Line6 = array('x' => 82.5, 'y' => 62.5, 'length' => 72, 'thick' => 0.25, 'horizontal' => false);
     $Line7 = array('x' => 99, 'y' => 62.5, 'length' => 72, 'thick' => 0.25, 'horizontal' => false);
     $PrimaryCodeBorder1_1 = array('x' => 1, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder1_2 = array('x' => 1.5, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $PrimaryCodeBorder2_1 = array('x' => 1, 'y' => 55, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder2_2 = array('x' => 1.5, 'y' => 50, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $PrimaryCodeBorder3_1 = array('x' => 22.5, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder3_2 = array('x' => 27, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $PrimaryCodeBorder4_1 = array('x' => 22.5, 'y' => 55, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder4_2 = array('x' => 27, 'y' => 50, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $LayoutCollection = array($ControlBar1, $ControlBar2, $ControlBar3, $ControlBar4, $Line1, $Line2, $Line3, $Line4, $Line5, $Line6, $Line7, $PrimaryCodeBorder1_1, $PrimaryCodeBorder1_2, $PrimaryCodeBorder2_1, $PrimaryCodeBorder2_2, $PrimaryCodeBorder3_1, $PrimaryCodeBorder3_2, $PrimaryCodeBorder4_1, $PrimaryCodeBorder4_2);
     foreach ($LayoutCollection as $element) {
         // define a style
         $controlLayoutStyle = new Zend_Pdf_Style();
         $controlLayoutStyle->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
         $controlLayoutStyle->setLineColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
         $controlLayoutStyle->setLineWidth($this->mmToPts($element['thick']));
         $this->page->setStyle($controlLayoutStyle);
         if ($element['horizontal']) {
             $this->page->drawLine($this->coordX($this->mmToPts($element['x'])), $this->coordY($this->mmToPts($element['y'])), $this->coordX($this->mmToPts($element['x']) + $this->mmToPts($element['length'])), $this->coordY($this->mmToPts($element['y'])));
         } else {
             $this->page->drawLine($this->coordX($this->mmToPts($element['x'])), $this->coordY($this->mmToPts($element['y'])), $this->coordX($this->mmToPts($element['x'])), $this->coordY($this->mmToPts($element['y']) + $this->mmToPts($element['length'])));
         }
     }
     try {
         // Erstelle ein neues Grafikobjekt
         $imageFile = SERVER_BASE . '/images/Logo_GLS.jpg';
         $stampImage = Zend_Pdf_Image::imageWithPath($imageFile);
     } catch (Zend_Pdf_Exception $e) {
         // Beispiel wie man mit Ladefehlern bei Grafiken umgeht.
         $stampImage = null;
     }
     if ($stampImage != null) {
         $this->page->drawImage($stampImage, $this->coordX(180), $this->coordY(0) - $this->mmToPts(149), $this->coordX($this->mmToPts(99)), $this->coordY($this->mmToPts(150)) + $this->mmToPts(14));
     }
     $this->page->setStyle($this->defaultStyle);
 }
Пример #5
0
 public function byProduct($product, $for_catalog = false)
 {
     $category = $product->findManyToManyRowset("Model_DbTable_Categories", "Model_DbTable_CategoryXref")->current();
     if ($category) {
         $this->category = $category->getBcnName();
     } else {
         $this->category = "Неизвестно";
     }
     $productParams = $product->getParams();
     if (!$for_catalog) {
         $this->margins = array('top' => 35, 'right' => 20, 'bottom' => 35, 'left' => 20);
     }
     if (is_null($this->book)) {
         $page = $this->createBook(1, $for_catalog);
     } else {
         $page = $this->lastPage();
     }
     $offset = $for_catalog == false ? 0 : $page->getHeight() - $page->getCurrentPosition() - 1;
     if (!$for_catalog) {
         $page->setMargins(35, 20, 35, 20);
     }
     $noteStyle = new Zend_Pdf_Style();
     $noteStyle->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->format == 'A4' ? 6.5 : 4.5);
     $noteStyle->setLineWidth($page->getWidth() - 20);
     $style = new Zend_Pdf_Style();
     $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->format == 'A4' ? 8.0 : 6.5);
     $style->setLineWidth($page->getWidth());
     $paramsLinesCount = 0;
     foreach ($productParams as $param) {
         $paramsLinesCount += count(explode("\n", $param->value));
     }
     $paramsLinesCount++;
     $subproductsModel = new Model_DbTable_Subproducts();
     $select = $subproductsModel->select()->order('order ASC');
     $subProducts = $product->findDependentRowset("Model_DbTable_Subproducts", 'SubproductsRel', $select);
     // расчет высоты всего продукта, проверка влезает ли он на страницу, если не влезает смотрим сколько именно не влезает и есть ли субпродукты,
     // которые мы може отрисовать на этой странице и перенести отстаток на другую страницу
     $productHeightWithoutTable = 10 + max(array(80, $this->format == 'A4' ? $paramsLinesCount * 12 : $paramsLinesCount * 8)) + ($product->description ? $page->getTextBlockHeight(trim($product->description), $style, 3) : 0);
     $productHeight = 20 + max(array(80, $this->format == 'A4' ? $paramsLinesCount * 12 : $paramsLinesCount * 8)) + ($product->description ? $page->getTextBlockHeight(trim($product->description), $style, 3) : 0) + (count($subProducts) <= 30 ? $this->format == 'A4' ? count($subProducts) * 12 + 10 : count($subProducts) * 8 + 12 + 15 : 0) + ($product->note ? $page->getTextBlockHeight($product->note, $noteStyle) + 10 : 0);
     // note*/
     if ($offset) {
         if ($page->getHeight() - $offset - 10 < (count($subProducts) <= 30 ? $productHeight : intval($productHeight) + 40)) {
             if ($page->getPageNumber() > 1) {
                 $page->drawCategory(isset($this->old_category) ? $this->old_category : $this->category);
                 $this->old_category = NULL;
                 $page = $this->addPage();
                 $offset = 0;
             }
         } else {
             if ($page->getCurrentPosition() < 700 && $for_catalog) {
                 $offset -= 5;
             }
             $page->init($offset);
             $this->old_category = $this->category;
         }
     } else {
         $this->old_category = $this->category;
     }
     $this->product_page = $page->getPageNumber();
     // DEBUG auto-height calculate
     if (isset($_REQUEST['DEBUG'])) {
         $page->drawHorizontalLine(-20, 575, $page->getHeight() - $offset, 1, new Zend_Pdf_Color_Html('green'));
         $page->drawHorizontalLine(-20, 575, $page->getHeight() - $offset - $productHeight, 2, new Zend_Pdf_Color_Html('red'));
         $page->drawTextBlock(count($subProducts), -20, $page->getHeight() - $offset - $productHeight);
     }
     // --- block / information
     $page->setFont(Model_Static_Fonts::get("Franklin Gothic Demi Cond"), 14);
     $page->drawTextBlock($product->sku, 5, $page->getHeight() - $offset);
     $page->setFont(Model_Static_Fonts::get("Franklin Gothic Demi Cond"), 10);
     $page->drawTextBlock($product->name, 5, $page->getHeight() - 10 - $offset);
     // --- block / images
     $images = array($product->image);
     if ($product->a_images) {
         $images[] = $product->a_images[0];
     }
     $x = 0;
     if ($page->getPageNumber() % 2 == 0) {
         // если картинки справа (иконки слева)
         $images = array_reverse($images);
         // здесь нужно посчитать правильные ширины отступов начала изображений
         $x = $page->getWidth() - 5;
         foreach ($images as $image) {
             $sizes = $page->picSize($this->getProductImageFullpath($image), $this::IMAGE_SIZE, $this::IMAGE_SIZE, 2);
             //$x = $x - $this::IMAGE_SIZE * $sizes[0];
             $x = $x - $this::IMAGE_SIZE;
             //echo $image." ";
         }
         $x = $x - 5 * (count($images) - 1);
     } else {
         // картинки слева - просто задаем базовый отступ по x
         $x += 5;
     }
     //echo $x." ";
     $count = 0;
     // count of images (x75)
     //в зависимости от задачи, выбираем папку с картинками, за это отвечает параметр $print
     foreach ($images as $image) {
         if ($this->print) {
             //$c = $page -> drawPic(APPLICATION_ROOT . '/files/images/product_tiff/' . substr($image, 0, strripos($image, ".")).'.tif', $x, $page -> getHeight() - 20 - $offset, $this::IMAGE_SIZE, $this::IMAGE_SIZE, isset($images[1]) ? 1 : 2,1);
             $c = $page->drawPic($this->getProductImageFullpath($image), $x, $page->getHeight() - 20 - $offset, $this::IMAGE_SIZE, $this::IMAGE_SIZE, 2, 1);
         } else {
             $c = $page->drawPic($this->getProductImageFullpath($image), $x, $page->getHeight() - 20 - $offset, $this::IMAGE_SIZE, $this::IMAGE_SIZE, isset($images[1]) ? 1 : 2, 1);
         }
         if ($page->getPageNumber() % 2 == 0) {
             // если картинки справа, то не считаем полную ширину
             $x += $this::IMAGE_SIZE + 5;
         } else {
             $x += $this::IMAGE_SIZE * $c + 5;
         }
         $count += $c;
     }
     // --- block / params
     $offsetX = $page->getPageNumber() % 2 ? $this::IMAGE_SIZE * $count + 15 : 10;
     $tableWidth = $page->getWidth() - $this::IMAGE_SIZE * $count - 25;
     if (count($productParams) > 0) {
         $params = array();
         foreach ($productParams as $productParam) {
             $params[] = array($productParam->name, str_replace(array(' ' . chr('0x0D') . chr('0x0A'), chr('0x0D') . chr('0x0A')), ', ', $productParam->value));
         }
         $page->drawTable($params, $offsetX, $page->getHeight() - 30 - $offset, $tableWidth);
     }
     // --- block / description
     if ($product->description) {
         $style = new Zend_Pdf_Style();
         $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->format == 'A4' ? 8.0 : 6.5);
         $style->setLineWidth($page->getWidth());
         if ($for_catalog) {
             $page->drawTextBlock(str_replace(array('      ', '       ', '        '), '. ', trim($product->description)), 5, $page->getCurrentPosition() + 25, $style, 3);
             //chr('0x0D').chr('0x0A')
             $page->setCurrentPosition($page->getCurrentPosition() + 10);
         } else {
             $page->drawTextBlock(str_replace(array('      ', '       ', '        '), chr('0x0D') . chr('0x0A'), trim($product->description)), 5, $page->getCurrentPosition() + 15, $style, 3);
             $page->setCurrentPosition($page->getCurrentPosition() + 15);
         }
     }
     // --- block / sub products
     $params = array();
     $subproductParams = $product->getSubParams();
     foreach ($subProducts as $subProduct) {
         $productParams = $subProduct->getParamsValues();
         $row = array($subProduct->sku);
         foreach ($productParams as $productParam) {
             $row[] = $productParam->value;
         }
         $params[] = $row;
     }
     if (count($subProducts) > 0) {
         $header = array('Название');
         foreach ($subproductParams as $subproductParam) {
             $header[] = $subproductParam->name;
         }
     }
     if ($product->note) {
         $noteHeight = $page->getTextBlockHeight($product->note, $noteStyle);
     } else {
         $noteHeight = 0;
     }
     //
     //	$noteHeight = 0;
     $curRow = 0;
     if ($params) {
         $page->setCurrentPosition($page->getCurrentPosition() + 20);
         // move table-description
         while ($curRow !== NULL) {
             $curRow = $page->drawTable($params, 0, $page->getCurrentPosition(), $page->getWidth() - 5, $noteHeight, $header, $curRow, true, $product->note);
             if ($curRow !== NULL) {
                 $page->drawCategory($this->category);
             }
             //		else {
             //	                if ($product -> note && $for_catalog) {
             //				$page -> drawTextBlock($product -> note, 5, $page -> getCurrentPosition() + 24, $noteStyle);
             //			}elseif($product -> note){
             //				$page -> drawTextBlock($product -> note, 5, $page -> getCurrentPosition() + 62, $noteStyle);
             //			}
             //		}
             //		$page -> drawTextBlock($curRow, -20, $page -> getHeight() - $offset - $productHeight);
             $page = $this->addPage(false);
             if ($curRow !== NULL) {
                 $curRow++;
             }
         }
     } else {
         $this->AddPage(false);
     }
     return $this->book;
 }
Пример #6
0
 public function __construct($param1, $param2 = null, $param3 = null)
 {
     parent::__construct($param1, $param2, $param3);
     $style = new Zend_Pdf_Style();
     $style->setLineColor(new Zend_Pdf_Color_Html("#000000"));
     $style->setFillColor(new Zend_Pdf_Color_Html("#000000"));
     $style->setLineWidth(0.5);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
     $style->setFont($font, 10);
     $style->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
     $this->_defaultStyle = $style;
     $this->setStyle($style);
 }
Пример #7
0
 /**
  * Draw table or part of table by coordinates with or without header
  *
  * @param array[][] $table Table values
  * @param int $x x coordinate
  * @param int $y y coordinate
  * @param int $width Table width
  * @param int $max_y Minimal y coordinate
  * @param array[] $header Table header
  * @param int $start_row start row of table
  *
  * @return int End row
  *
  * @api
  */
 function drawTable($table, $x, $y, $width, $max_y = 0, $header = NULL, $start_row = 0, $params = false, $note = '')
 {
     if (!$table) {
         return NULL;
     }
     if ($start_row > count($table) - 1) {
         if ($this->currentPosition > $y - $this->MARGIN['bottom']) {
             $this->currentPosition = $y - $this->MARGIN['bottom'];
         }
         return NULL;
     }
     $max_widths = $this->getTableColumnsMaxWidths($table, $params);
     $avg_widths = $this->getTableColumnsAverageWidths($table, $params);
     //	parent::drawText(implode(',',$max_widths), $this -> MARGIN['left'], $this -> MARGIN['bottom'], 'UTF-8');
     //вычисляем ширину столбцов, в зависимости от того, какую таблицу рисуем выбираем нужную формулу
     if ($params) {
         $awidth = array_sum($max_widths) - 0;
     } else {
         $awidth = array_sum($avg_widths) - $avg_widths[0] - 5;
         $widths = array($max_widths[0]);
     }
     // Подгоняем ширину под заданную, через процентные соотношения
     foreach ($avg_widths as $i => $a_w) {
         if ($params) {
             $widths[] = $a_w / $awidth * $width;
         } elseif ($i != 0) {
             $widths[] = $a_w / $awidth * ($width - $widths[0] - 10);
         }
     }
     // запомним наш $x  и текущий $y
     $coords = array($x, $y);
     // write header ( if exists )
     if ($header) {
         //создаем сностки для таблици с параметрами. В зависимости от количества столбцов и длинны названия параметра, заменяем его и записываем в сноски
         $snoski = '';
         $s_number = 1;
         $widthSnoski = $width;
         $this->pageFormat == 'A4' ? $countChar = 30 : ($countChar = 10);
         foreach ($header as $i => $column) {
             if (count($header) > 7 && strlen($column) >= $countChar && $i != 0 || $column == 'Типоразмер') {
                 if ($widthSnoski < $this->widthForStringUsingFontsize($s_number . '* - ' . $column . '; ', Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski) + $this->widthForStringUsingFontsize($snoski, Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski)) {
                     $snoski .= chr('0x0D') . chr('0x0A');
                     $widthSnoski *= 2;
                 }
                 $snoski .= $s_number . '* - ' . $column . '; ';
                 $header[$i] = $s_number . '*';
                 $s_number++;
             } elseif ($this->pageFormat == 'A5') {
                 $header[$i] = str_replace('(', chr('0x0D') . chr('0x0A') . '(', $column);
             }
         }
         $snoski .= ' ' . $note;
         $this->saveGS();
         $style = new Zend_Pdf_Style();
         $style->setFillColor(new Zend_Pdf_Color_Html("white"));
         $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatHeader);
         // Bold
         $this->setStyle($style);
         // calculate height of header
         $height = 0;
         foreach ($header as $i => $column) {
             $style->setLineWidth($widths[$i]);
             $height = max($height, $this->getTextBlockHeight(trim($column), $style, 0, true));
         }
         // if we can't write 2 line - exit
         if ($y - $height - $max_y < 16) {
             $this->restoreGS();
             return 0;
         }
         // else - draw header background
         $this->drawHorizontalLine($coords[0] + 5, $coords[0] + $width, $this->pageFormat == 'A4' ? $y - $height / 2 + 5.5 : $y - $height / 2 + 3.5, $height, new Zend_Pdf_Color_Html("#0095da"));
         // here - write header
         //
         foreach ($header as $i => $col) {
             $style->setLineWidth($widths[$i]);
             $width_text = $this->widthForStringUsingFontsize($col, $style->getFont(), $style->getFontSize());
             if ($widths[$i] > $width_text && $i != 0) {
                 $iLeft = $x + ($widths[$i] - $width_text) / 2;
             } else {
                 $iLeft = $x + 8;
             }
             $y = min($y, $this->drawTextBlock(str_replace(array(''), array(''), trim($col)), $iLeft + 1 * ($i == 0), $coords[1] - 3, $style, 0, true));
             $x += $widths[$i];
         }
         $this->restoreGS();
     }
     // make offset(3)
     if ($this->pageFormat == 'A4') {
         $y -= 2;
     } elseif ($this->pageFormat == 'A5') {
         $y -= 0;
     }
     // write table data
     $coords[0] += 5;
     $width -= 5;
     for ($c_row = $start_row; $c_row < count($table); $c_row++) {
         $rowset = $table[$c_row];
         $x = $coords[0];
         $line_y = $y;
         // for table with headers odd lines have bg
         if ($c_row % 2 != 0 && $header) {
             $style = new Zend_Pdf_Style();
             $style->setLineWidth($widths[$i] + 10);
             $style->setFont(Model_Static_Fonts::get("Arial Narrow" . ($i == 0 && !$header ? ' Bold' : '')), $this->fontSizeFormat);
             $height = 0;
             foreach ($rowset as $i => $col) {
                 $style->setLineWidth($widths[$i]);
                 $height = max($height, $this->getTextBlockHeight($col, $style));
             }
             if ($this->pageFormat == 'A4') {
                 $this->drawHorizontalLine($x, $x + $width, $y + (3 - intval(($height - 2) / 6 - 1.5) * 2), $height - 4, new Zend_Pdf_Color_Html("#e7e7e7"));
             } elseif ($this->pageFormat == 'A5') {
                 $this->drawHorizontalLine($x, $x + $width, $y + (2 - intval(($height - 2) / 6 - 1) * 2), $height - 4, new Zend_Pdf_Color_Html("#e7e7e7"));
             }
         }
         foreach ($rowset as $i => $col) {
             $style = new Zend_Pdf_Style();
             if ($params) {
                 $style->setFont(Model_Static_Fonts::get("Arial Narrow" . ($i == 0 && !$header ? ' Bold' : '')), $this->fontSizeFormat);
             } else {
                 $style->setFont(Model_Static_Fonts::get("Arial Narrow" . ($i == 0 && !$header ? ' Bold' : '')), $this->fontSizeFormatDiscription);
             }
             $style->setLineWidth($widths[$i]);
             // пишем клетку, и запоминаем макс высоту ( для многострочности )
             // выравнивание по центру значения таблицы с параметрами
             $width_text = $this->widthForStringUsingFontsize(trim($col), $style->getFont(), $style->getFontSize());
             if ($widths[$i] > $width_text && $params && $i != 0) {
                 $iLeft = $x + ($widths[$i] - $width_text) / 2;
                 $line_y = min($line_y, $this->drawTextBlock(str_replace('  ', ' ', trim($col)), $iLeft, $y, $style, -2));
             } elseif ($params && $i == 0) {
                 $iLeft = $x + 10;
                 $line_y = min($line_y, $this->drawTextBlock(str_replace('  ', ' ', trim($col)), $iLeft, $y, $style, -2));
             } else {
                 $iLeft = $x;
                 $line_y = min($line_y, $this->drawTextBlock(str_replace('  ', ' ', trim($col)), $iLeft, $y + 4, $style));
             }
             $x += $widths[$i];
         }
         $heightSnoski = 0;
         $y = $line_y;
         if ($header) {
             $style = new Zend_Pdf_Style();
             $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski);
             $style->setLineWidth($width);
             $heightSnoski = $this->getTextBlockHeight($snoski, $style, 0, true);
         }
         // проверим, не вышли ли бы за границы высоты, но не в последнем элементе
         if ($y - 11 - $heightSnoski < 8 && count($table) == 1) {
             if ($header) {
                 $this->drawTextBlock($snoski, 5, $y, $style);
                 //$page -> setCurrentPosition($page -> getCurrentPosition());
             }
             if ($this->currentPosition > $y - $this->MARGIN['bottom']) {
                 $this->currentPosition = $y - $this->MARGIN['bottom'];
             }
             return NULL;
         }
         if ($y - $max_y - $heightSnoski < 8 && $c_row != count($table) - 1) {
             //
             if ($header) {
                 $this->drawTextBlock($snoski, 5, $y, $style);
                 //$page -> setCurrentPosition($page -> getCurrentPosition());
             }
             if ($this->currentPosition > $y - $this->MARGIN['bottom']) {
                 $this->currentPosition = $y - $this->MARGIN['bottom'];
             }
             return $c_row;
         }
     }
     //$this -> drawTextBlock($y,  -20, $y + 10, $style);
     if ($this->currentPosition > $y - $this->MARGIN['bottom']) {
         $this->currentPosition = $y - $this->MARGIN['bottom'];
     }
     // пишем сноски в конце блока с парамаетрами
     if ($header) {
         $style = new Zend_Pdf_Style();
         $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski);
         $style->setLineWidth($width);
         $this->drawTextBlock($snoski, 5, $y, $style);
         //		$this -> drawTextBlock( $note, 5, $this -> getCurrentPosition() + 25, $style);
         //$this -> setCurrentPosition($this -> getCurrentPosition());
     }
     return NULL;
 }