PDFBOX-1583: stop the loop if the work is done as proposed by Adrian Nistor

git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1476795 13f79535-47bb-0310-9956-ffa450edef68