Index: src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
===================================================================
--- src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java	(revision 1157267)
+++ src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java	(working copy)
@@ -149,85 +149,70 @@
         // or references to arrays which have references to pages
         // or references to arrays which have references to arrays which have references to pages
         // or ... (I think you get the idea...)
-        processListOfPageReferences(getDocumentCatalog().getPages().getKids());
+        
+        // we start with the root of the pages
+        PDPageNode pageNode = getDocumentCatalog().getPages();
+        
+        // we need to parse the dictionary to either get the information for the pages or
+        // page nodes within the root pages dictionary
+        parseCatalogObject(pageNode.getDictionary());
     }
     
-    private void processListOfPageReferences(List<Object> pageNodes)
-    {
-        for(int i=0; i < pageNodes.size(); ++i) 
-        {
-            Object pageOrArray = pageNodes.get(i);
-            if(pageOrArray instanceof PDPage)
-            {
-                List pageArray = ((((PDPage)pageOrArray).getParent()).getKids());
-                parseCatalogObject((COSObject)pageArray.get(i));
-            }
-            else if(pageOrArray instanceof PDPageNode)
-            {
-                processListOfPageReferences(((PDPageNode)pageOrArray).getKids());
-            }
-        }
-    }
              
     /**
-     * This will either add the page passed in, or, if it's a pointer to an array
-     * of pages, it'll recursivly call itself and process everything in the list.
+     * This will process the dictionary associated with the page node and the page
+     * information contained within or recursively call itself if there are additional
+     *  nodes within the dictionary.
      */
-    private void parseCatalogObject(COSObject thePageOrArrayObject) 
+    private void parseCatalogObject(COSDictionary pageNodeDictionary) 
     {
-        COSBase arrayCountBase = thePageOrArrayObject.getItem(COSName.COUNT);
+        COSBase arrayCountBase = pageNodeDictionary.getDictionaryObject(COSName.COUNT);
         int arrayCount = -1;
         if(arrayCountBase instanceof COSInteger)
         {
             arrayCount = ((COSInteger)arrayCountBase).intValue();
         }
  
-        COSBase kidsBase = thePageOrArrayObject.getItem(COSName.KIDS);
+        COSBase kidsBase = pageNodeDictionary.getDictionaryObject(COSName.KIDS);
         int kidsCount = -1;
         if(kidsBase instanceof COSArray)
         {
             kidsCount = ((COSArray)kidsBase).size();
         }
-     
-        if(arrayCount == -1 || kidsCount == -1) 
+
+
+        // we either have an array of page pointers, or an array of arrays
+        if(arrayCount == kidsCount) 
         {
-            // these cases occur when we have a page, not an array of pages
-            String objStr = String.valueOf(thePageOrArrayObject.getObjectNumber().intValue());
-            String genStr = String.valueOf(thePageOrArrayObject.getGenerationNumber().intValue());
-            getPageMap().put(objStr+","+genStr, new Integer(getPageMap().size()+1));
+            // process the kids... they're all references to pages
+            COSArray kidsArray = ((COSArray)kidsBase);
+            for(int i=0; i<kidsArray.size(); ++i) 
+            {
+                COSObject thisObject = (COSObject)kidsArray.get(i);
+                String objStr = String.valueOf(thisObject.getObjectNumber().intValue());
+                String genStr = String.valueOf(thisObject.getGenerationNumber().intValue());
+                getPageMap().put(objStr+","+genStr, new Integer(getPageMap().size()+1));
+            }
         } 
         else 
         {
-            // we either have an array of page pointers, or an array of arrays
-            if(arrayCount == kidsCount) 
+            // this object is an array of references to other arrays
+            COSArray list = null;
+            if(kidsBase instanceof COSArray)
             {
-                // process the kids... they're all references to pages
-                COSArray kidsArray = ((COSArray)kidsBase);
-                for(int i=0; i<kidsArray.size(); ++i) 
-                {
-                    COSObject thisObject = (COSObject)kidsArray.get(i);
-                    String objStr = String.valueOf(thisObject.getObjectNumber().intValue());
-                    String genStr = String.valueOf(thisObject.getGenerationNumber().intValue());
-                    getPageMap().put(objStr+","+genStr, new Integer(getPageMap().size()+1));
-                }
-            } 
-            else 
+                list = ((COSArray)kidsBase);
+            }
+            if(list != null) 
             {
-                // this object is an array of references to other arrays
-                COSArray list = null;
-                if(kidsBase instanceof COSArray)
+                for(int arrayCounter=0; arrayCounter < list.size(); ++arrayCounter) 
                 {
-                    list = ((COSArray)kidsBase);
-                }
-                if(list != null) 
-                {
-                    for(int arrayCounter=0; arrayCounter < list.size(); ++arrayCounter) 
-                    {
-                        parseCatalogObject((COSObject)list.get(arrayCounter));
-                    }
+                    // recall with the nodeObjects for parsing
+                    COSObject nodeObject = (COSObject)list.get(arrayCounter);
+                    parseCatalogObject((COSDictionary) nodeObject.getObject());
                 }
             }
         }
+
     }
  
     /**
