'templates' nicht aus %::myconfig, sondern aus Defaults-Tabelle holen
[kivitendo-erp.git] / modules / override / PDF / Table.pm
index f950a72..113344d 100644 (file)
@@ -135,8 +135,8 @@ sub text_block {
       $line_width += $arg{'indent'};
     }
 
-    # Lets take from paragraph as many words as we can put into $width - $indent;
-    while ( @paragraph and $text_object->advancewidth( join("\x20", @line)."\x20" . $paragraph[0]) + $line_width < $width ) {
+    # Lets take from paragraph as many words as we can put into $width - $indent;. Always take at least one word; otherwise we'd end up in an infinite loop.
+    while (!scalar(@line) || (@paragraph && ($text_object->advancewidth( join("\x20", @line)."\x20" . $paragraph[0]) + $line_width < $width))) {
       push(@line, shift(@paragraph));
     }
     $line_width += $text_object->advancewidth(join('', @line));
@@ -981,6 +981,7 @@ Stone Environmental Inc. (www.stone-env.com).
 The text_block() method is a slightly modified copy of the one from
 Rick Measham's PDF::API2 tutorial at
 http://pdfapi2.sourceforge.net/cgi-bin/view/Main/YourFirstDocument
+update: The tutorial is no longer available. Please visit http://pdfapi2.sourceforge.net .
 
 by Desislav Kamenov