Index: src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
===================================================================
--- src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java	(révision 1341593)
+++ src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java	(copie de travail)
@@ -20,6 +20,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -49,6 +50,7 @@
 import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.cos.COSString;
 import org.apache.pdfbox.exceptions.CryptographyException;
+import org.apache.pdfbox.io.IOUtils;
 import org.apache.pdfbox.io.PushBackInputStream;
 import org.apache.pdfbox.io.RandomAccess;
 import org.apache.pdfbox.io.RandomAccessBuffer;
@@ -112,6 +114,12 @@
     private boolean initialParseDone = false;
     private boolean allPagesParsed   = false;
         
+  	/**
+  	 * <code>true</code> if the NonSequentialPDFParser is initialized by a InputStream, in this case
+  	 * a temporary file is created. At the end of the {@linkplain #parse()} method,the temporary file will
+  	 * be deleted.
+  	 */
+  	private boolean isTmpPDFFile = false;
     private static final Log LOG = LogFactory.getLog( NonSequentialPDFParser.class );
     
     // ------------------------------------------------------------------------
@@ -168,7 +176,12 @@
     public NonSequentialPDFParser( File file, RandomAccess raBuf, String decryptionPassword ) throws IOException
     {
         super( EMPTY_INPUT_STREAM, null, false );
-            
+    		pdfFile = file;
+    		raStream = new RandomAccessBufferedFileInputStream( pdfFile );
+    		init(file, raBuf, decryptionPassword);
+    	}
+
+    	private void init(File file, RandomAccess raBuf, String decryptionPassword) throws IOException {
         String eofLookupRangeStr = System.getProperty( SYSPROP_EOFLOOKUPRANGE );
         if ( eofLookupRangeStr != null )
         {
@@ -183,9 +196,6 @@
             }
         }
     
-        pdfFile = file;
-        raStream = new RandomAccessBufferedFileInputStream( pdfFile );
-    
         setDocument( ( raBuf == null ) ? new COSDocument( new RandomAccessBuffer(), false ) :
                                          new COSDocument( raBuf, false ) );
     
@@ -193,7 +203,37 @@
         
         password = decryptionPassword;
     }
-        
+    	public NonSequentialPDFParser(InputStream input) throws IOException
+    	{
+    		super( EMPTY_INPUT_STREAM, null, false );
+    		pdfFile = createTmpFile(input);
+    		raStream = new RandomAccessBufferedFileInputStream( pdfFile );
+    		init(pdfFile, null, ""); 
+    	}
+
+    	/**
+    	 * Create a temporary file with the input stream.
+    	 * If the creation succeed, the {@linkplain #isTmpPDFFile} is set to true.
+    	 * This Temporary file will be deleted at end of the parse method
+    	 * @param input
+    	 * @return
+    	 * @throws IOException
+    	 */
+    	private File createTmpFile(InputStream input) throws IOException {
+    		File tmpFile = null;
+    		FileOutputStream fos = null;
+    		try {
+    			tmpFile = File.createTempFile("tmp", ".pdf");
+    			fos = new FileOutputStream(tmpFile);
+    			IOUtils.copy(input, fos);
+    			isTmpPDFFile = true;
+    			return tmpFile;
+    		} finally {
+    			IOUtils.closeQuietly(input);
+    			IOUtils.closeQuietly(fos);
+    		}
+    	}
+
     // ------------------------------------------------------------------------
     /** 
      *  Sets how many trailing bytes of PDF file are searched for
@@ -340,6 +380,16 @@
                 }
             }
         }
+      
+    		// Are there other part that never load Object reference ??
+        // Trailer entries are useful in the preflight document
+    		for (COSBase trailerEntry : getDocument().getTrailer().getValues()) {
+    			if ( trailerEntry instanceof COSObject )
+    			{
+    				COSObject tmpObj = (COSObject) trailerEntry;
+    				parseObjectDynamically( tmpObj, true );
+    			}
+    		}
         initialParseDone = true;
     }
     
@@ -596,7 +646,9 @@
             } 
             catch ( IOException ioe ) 
             {}
-                    
+
+      			deleteTempFile();
+      			
             if ( exceptionOccurred && ( document != null ) )
             {
                 try 
@@ -608,6 +660,16 @@
             }
         }
     }   
+    
+  	protected void deleteTempFile() {
+  		if (isTmpPDFFile) {
+  			try {
+  				if (!pdfFile.delete()) LOG.warn("Temporary file '" + pdfFile.getName() + "' can't be deleted");
+  			} catch (SecurityException e) {
+  				LOG.warn("Temporary file '" + pdfFile.getName() + "' can't be deleted", e);
+  			}
+  		}
+  	}
 
     // ------------------------------------------------------------------------
     /** 
