ItSpiderman has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372139 )

Change subject: UEModulePDF: Fix for tables being too wide
......................................................................

UEModulePDF: Fix for tables being too wide

In tables with many columns it can happen that the table overflows the
width of the size in PDF export.

Since table-layout must be set, it cannot be done by simple setting
"width" attribute of table, but in this, a little hacky way, to alter
"style" tag.

It can also be done over css class, which would more elegantly be added to
tables in php, but this might not work, in case wiki uses custom skin,
which does not have class defined.

Change-Id: I85f3078a68c22b4b8a187842a3548132d58b9a6f
ERM: #3591
---
M UEModulePDF/includes/PDFPageProvider.class.php
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/39/372139/1

diff --git a/UEModulePDF/includes/PDFPageProvider.class.php 
b/UEModulePDF/includes/PDFPageProvider.class.php
index 36bf034..afb6e8b 100644
--- a/UEModulePDF/includes/PDFPageProvider.class.php
+++ b/UEModulePDF/includes/PDFPageProvider.class.php
@@ -276,6 +276,13 @@
                //Make tables paginatable
                $oTableElements = $oPageDOM->getElementsByTagName( 'table' );
                foreach( $oTableElements as $oTableElement ) {
+                       $sStyleTag = $oTableElement->getAttribute( 'style' );
+                       //make sure style tag ends with semicolon
+                       if( substr( trim( $sStyleTag ), -1 ) !== ";" ) {
+                               $sStyleTag .= ";";
+                       }
+                       $oTableElement->setAttribute( 'style', $sStyleTag . ' 
table-layout: fixed; max-width: 700px;' );
+
                        $oTableRows = $oTableElement->childNodes; //We only 
want direct children, so we cannot use getElementsByTagName
                        $aRows = array();
                        foreach( $oTableRows as $oTableRow ){

-- 
To view, visit https://gerrit.wikimedia.org/r/372139
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85f3078a68c22b4b8a187842a3548132d58b9a6f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <d.savulje...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to