Index: PdfPainter.cpp
===================================================================
--- PdfPainter.cpp	(revision 1857)
+++ PdfPainter.cpp	(working copy)
@@ -1051,6 +1051,18 @@
                     dCurWidthOfLine = 0.0;
                 }
             }
+            else if ((dCurWidthOfLine + m_pFont->GetFontMetrics()->UnicodeCharWidth(SwapCharBytesIfRequired(*pszCurrentCharacter))) > dWidth)
+            {
+                vecLines.push_back(PdfString(pszLineBegin, pszCurrentCharacter - pszLineBegin));
+                //skip the spaces appearing at the end of line
+                while (IsSpaceChar(*(pszCurrentCharacter + 1)))
+                    pszCurrentCharacter++;
+
+                pszStartOfCurrentWord = pszCurrentCharacter + 1;
+                pszLineBegin = pszStartOfCurrentWord;
+                startOfWord = true;
+                dCurWidthOfLine = 0.0;
+            }
             else 
             {           
                 dCurWidthOfLine += m_pFont->GetFontMetrics()->UnicodeCharWidth( SwapCharBytesIfRequired( *pszCurrentCharacter ) );
