/** * Insert totals to pdf page * * @param \Zend_Pdf_Page $page * @param \Magento\Sales\Model\AbstractModel $source * @return \Zend_Pdf_Page */ protected function insertTotals($page, $source) { $order = $source->getOrder(); $totals = $this->_getTotalsList(); $lineBlock = array('lines' => array(), 'height' => 15); foreach ($totals as $total) { $total->setOrder($order)->setSource($source); if ($total->canDisplay()) { $total->setFontSize(10); foreach ($total->getTotalsForDisplay() as $totalData) { $lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 565, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold')); } } } $this->y -= 20; $page = $this->drawLineBlocks($page, array($lineBlock)); return $page; }