Faster PDF generation using only ImageMagik

This commit is contained in:
2015-06-28 02:27:29 +02:00
parent da860617b5
commit af11db9346
2 changed files with 6 additions and 23 deletions

View File

@@ -24,8 +24,7 @@ function Scan($device,$resolution,$format,$size,$destFileBase){
global $ScanImage;
global $PNMtoJPEG;
global $PNMtoPNG;
global $PNMtoPS;
global $PStoPDF;
global $ImageMagik;
$DestFile=$PreviewDir.$destFileBase;
$Command=$ScanImage." -d ".$device.
@@ -57,26 +56,12 @@ function Scan($device,$resolution,$format,$size,$destFileBase){
$Scan=ExecCommand($Command);
}
if($format=="pdf"){
$DestFile2=$DestFile.".pnm";
$Command.=" > {$DestFile2}";
$DestFile2=$DestFile.".jpg";
$Command.=" | {$PNMtoJPEG} --quality=100 > ".$DestFile2;
$Scan=ExecCommand($Command);
$DestFile.=".pdf";
$Command="cat {$DestFile2} | {$PNMtoPS}";
if($size=="A4"){
$Command.=" -width=8.3 -height=11.7 ";
}
if($size=="A5Port"){
$Command.=" -width=5.8 -height=8.3 ";
}
if($size=="A5Land"){
$Command.=" -width=8.3 -height=5.8 ";
}
if($size=="Letter"){
$Command.=" -width=8.5 -height=11 ";
}
$Command.=" | {$PStoPDF} - {$DestFile}";
$Convert=ExecCommand($Command);
$Command=$ImageMagik." ".$DestFile2." ".$DestFile;
$Scan=ExecCommand($Command);
}
return $DestFile;
}