将doc docx转化成pdf
yum install unoconv
unoconv -f pdf 1.docx
unoconv -f pdf 33.doc
public static function getPdfPages($path){
if(!file_exists($path)) return array(false,"文件\"{$path}\"不存在!");
if(!is_readable($path)) return array(false,"文件\"{$path}\"不可读!");
// 打开文件
$fp=@fopen($path,"r");
if (!$fp) {
return array(false,"打开文件\"{$path}\"失败");
}else {
$max=0;
while(!feof($fp)) {
$line = fgets($fp,255);
if (preg_match('/\/Count [0-9]+/', $line, $matches)){
preg_match('/[0-9]+/',$matches[0], $matches2);
if ($max
}
}
fclose($fp);
// 返回页数
$page= array(true,$max);
return $page[1];
}
set_time_limit(0);
putenv('PATH=/www/wwwroot/print.jcdd315.com/public');
shell_exec("/usr/bin/unoconv -f pdf $filename 2>&1");