信呼OA版本v2.3.8

This commit is contained in:
雨中磐石
2022-08-14 16:47:40 +08:00
parent 4640677d27
commit e3fcd913e3
1405 changed files with 133635 additions and 73 deletions

View File

@@ -0,0 +1,35 @@
<?php
/**
* 用libreoffice相关linux和win都可以用
*/
class libreofficeChajian extends Chajian{
/**
* 转pdf
*/
public function filetopdf($fileid)
{
$path = getconfig('libreoffice_path');
if(isempt($path))return returnerror('未配置libreoffice的路径');
$frs = m('file')->getone($fileid);
if(!$frs)return returnerror('文件不存在');
$filepath = $frs['filepath'];
$pdfpath = $frs['pdfpath'];
if(!isempt($pdfpath) && file_exists($pdfpath))return returnerror('已经转化过了');;
$fpath = ''.ROOT_PATH.'/'.$filepath.'';
$outdir = substr($fpath,0, strripos($fpath,'/'));
if(contain(PHP_OS,'WIN')){
$cmd = '"'.str_ireplace('LibreOffice','libreoffice',$path).'\program\soffice.exe"';
$fpath = str_replace('/','\\', $fpath);
$outdir = str_replace('/','\\', $outdir);
}else{
$cmd = $path;
}
$cmd .=' --headless --invisible --convert-to pdf:writer_pdf_Export "'.$fpath.'" --outdir "'.$outdir.'"';
return c('rockqueue')->pushcmd($cmd);
}
}