diff --git a/config/module.config.php b/config/module.config.php index acfa9743..67dccb82 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -155,6 +155,7 @@ 'header' => [ 'font' => 'helvetica', 'size' => 11, + 'height' => 7, 'color' => [ 0, @@ -171,6 +172,8 @@ 'data' => [ 'font' => 'helvetica', 'size' => 11, + 'padding' => 4, + 'contentPadding' => 2, 'color' => [ 0, diff --git a/src/ZfcDatagrid/Column/Action.php b/src/ZfcDatagrid/Column/Action.php index 90609d7a..4f8e4b9a 100644 --- a/src/ZfcDatagrid/Column/Action.php +++ b/src/ZfcDatagrid/Column/Action.php @@ -76,7 +76,7 @@ public function removeAction($key = null) } /** - * + * */ public function clearActions() { diff --git a/src/ZfcDatagrid/Renderer/TCPDF/Renderer.php b/src/ZfcDatagrid/Renderer/TCPDF/Renderer.php index 3ab5285a..372f49aa 100644 --- a/src/ZfcDatagrid/Renderer/TCPDF/Renderer.php +++ b/src/ZfcDatagrid/Renderer/TCPDF/Renderer.php @@ -214,12 +214,15 @@ protected function getRowHeight(array $row) { $optionsRenderer = $this->getOptionsRenderer(); $sizePoint = $optionsRenderer['style']['data']['size']; + $padding = $optionsRenderer['style']['data']['padding']; + $contentPadding = $optionsRenderer['style']['data']['contentPadding']; + // Points to MM $size = $sizePoint / 2.83464566929134; $pdf = $this->getPdf(); - $rowHeight = $size + 4; + $rowHeight = $size + $padding; foreach ($this->getColumnsToExport() as $col) { /* @var $col \ZfcDatagrid\Column\AbstractColumn */ @@ -227,7 +230,7 @@ protected function getRowHeight(array $row) case 'ZfcDatagrid\Column\Type\Image': // "min" height for such a column - $height = $col->getType()->getResizeHeight() + 2; + $height = $col->getType()->getResizeHeight() + $contentPadding; break; default: @@ -246,7 +249,7 @@ protected function getRowHeight(array $row) $height = $pdf->getStringHeight($col->getWidth(), $value); // include borders top/bottom - $height += 2; + $height += $contentPadding; break; } @@ -260,6 +263,8 @@ protected function getRowHeight(array $row) protected function printTableHeader() { + $optionsRenderer = $this->getOptionsRenderer(); + $height = $optionsRenderer['style']['header']['height']; $this->setFontHeader(); $pdf = $this->getPdf(); @@ -275,7 +280,7 @@ protected function printTableHeader() $label = $this->translate($col->getLabel()); // Do not wrap header labels, it will look very ugly, that's why max height is set to 7! - $pdf->MultiCell($col->getWidth(), 7, $label, 1, $this->getTextAlignment(), true, 2, $x, $y, true, 0, false, true, 7); + $pdf->MultiCell($col->getWidth(), $height, $label, 1, $this->getTextAlignment(), true, 2, $x, $y, true, 0, false, true, 7); } }