批量递归转换目录下pdf文件到swf
read()) !== false) { $file_path_name=$path.'/'.$file_in_dir; if(is_dir($file_path_name)){ echo "dirctory: " . $file_path_name . "\n"; if($file_in_dir == '.' or $file_in_dir == '..'){ echo "skip\n"; return ; }else{ convert_file($file_path_name); } }else{ echo "开始转换为swf: " . $file_path_name . "\n"; if (endsWith($file_in_dir,".pdf")){ $swf_file_dir = $path.'/pdf/'; if ( ! is_dir($swf_file_dir)) { mkdir ($swf_file_dir); //echo "create dir:".$swf_file_dir; } $swf_file_name = $swf_file_dir. bin2hex(basename($file_in_dir)); $cmd= "/usr/bin/pdf2swf -s flashversion=9 -s languagedir=/opt/www/xpdf/chinese-simplified -o ".$swf_file_name .".swf ".$file_path_name; //echo $cmd."\n"; system($cmd); } } }}convert_file($path);?>