You can find the number of pages in a PDF document by using the following code, using PHP4:

Code:
		//where $file is the full path to your PDF document.
		if(file_exists($file)) {
                        //open the file for reading
			if($handle = @fopen($file, "rb")) {
				$count = 0;
				$i=0;
				while (!feof($handle)) {
					if($i > 0) {
						$contents .= fread($handle,8152);
...