Index: pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
===================================================================
--- pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java	(revision 988155)
+++ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java	(working copy)
@@ -212,10 +212,67 @@
                 {
                     //an invalid dictionary, we are expecting
                     //the key, read until we can recover
-                    log.warn("Invalid dictionary, found:" + (char)c + " but expected:\''");
+                    log.warn("Invalid dictionary, found: '" + (char)c + "' but expected: '/'");
                     int read = pdfSource.read();
                     while(read != -1 && read != '/' && read != '>')
                     {
+                        if(read == 'e') 
+                        {
+                            read = pdfSource.read();
+                            if(read == 'n') 
+                            {
+                                read = pdfSource.read();
+                                if(read == 'd') 
+                                {
+                                    // this means we've probably encountered an "endsteam" or "endobj" element
+                                    read = pdfSource.read();
+                                    if(read == 's') 
+                                    {
+                                        read = pdfSource.read();
+                                        if(read == 't') 
+                                        {
+                                            read = pdfSource.read();
+                                            if(read == 'r') 
+                                            {
+                                                read = pdfSource.read();
+                                                if(read == 'e') 
+                                                {
+                                                    read = pdfSource.read();
+                                                    if(read == 'a') 
+                                                    {
+                                                        read = pdfSource.read();
+                                                        if(read == 'm') 
+                                                        {
+                                                            read = pdfSource.read();
+                                                            if(read == '\n') 
+                                                            {
+                                                                return obj; // we're done reading this object!
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                    else if(read == 'o') 
+                                    {
+                                        read = pdfSource.read();
+                                        if(read == 'b') 
+                                        {
+                                            read = pdfSource.read();
+                                            if(read == 'j') 
+                                            {
+                                                read = pdfSource.read();
+                                                if(read == '\r' || read == '\n') 
+                                                {
+                                                    return obj; // we're done reading this object!
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
                         read = pdfSource.read();
                     }
                     if(read != -1) 
@@ -765,8 +822,15 @@
             }
             else
             {
+                //it could be a bad object in the array which is just skipped
                 log.warn("Corrupt object reference" );
-                //it could be a bad object in the array which is just skipped
+                
+                // This could also be an "endobj" or "endstream" which means we can assume that
+                // the array has ended.
+                String isThisTheEnd = readString();
+                pdfSource.unread(isThisTheEnd.getBytes());
+                if("endobj".equals(isThisTheEnd) || "endstream".equals(isThisTheEnd))
+                    return po;
             }
             skipSpaces();
         }
@@ -1027,7 +1091,10 @@
                     throw new IOException( "Unknown dir object c='" + c +
                             "' cInt=" + (int)c + " peek='" + (char)peek + "' peekInt=" + peek + " " + pdfSource );
                 }
-
+                
+                // if it's an endstream/endobj, we want to put it back so the caller will see it
+                if("endobj".equals(badString) || "endstream".equals(badString))
+                    pdfSource.unread(badString.getBytes());
             }
         }
         }
