private TextExtractor parsePdf(File f) throws IOException {
		PDDocument doc = PDDocument.load(f);
		
		if(doc.isEncrypted()) {
            // Some documents are encrypted with the empty password. Try
		    // to decrypt with this password, or the one passed in on the
		    // command line (if any), and fail if we can't.
            try {
                doc.decrypt(password); // Defaults to the empty string.
            } catch (CryptographyException e) {
                throw new WrappedIOException("Can't decrypt document: ", e);
            } catch (InvalidPasswordException e) {
                throw new WrappedIOException("Document is encrypted: ", e);
            }
        }
		
		PDDocumentCatalog docCat = doc.getDocumentCatalog();
		
		PDPageNode root = docCat.getPages();
		List pages = new ArrayList();
		root.getAllKids(pages);
		
		TextExtractor te = new TextExtractor();
		
		for (Object p : pages) {
			PDPage page = (PDPage) p;
			
			te.setShouldSeparateByBeads(false);
			te.processStream(page, 
							 page.getResources(), 
							 page.getContents().getStream());
		}
		
		doc.close();
		
		return te;
	}