Faster PDF generation using only ImageMagik
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
$ScanImage = "/usr/bin/scanimage";
|
||||
$PNMtoJPEG = "/usr/bin/pnmtojpeg";
|
||||
$PNMtoPNG = "/usr/bin/pnmtopng";
|
||||
$PNMtoPS = "/usr/bin/pnmtops";
|
||||
$PStoPDF = "/usr/bin/ps2pdf14";
|
||||
$ImageMagik = "/usr/bin/convert";
|
||||
|
||||
// Destination dirs
|
||||
@@ -34,7 +32,7 @@ $Formats=array(
|
||||
"JPEG/JPG"=>"jpg",
|
||||
"PDF"=>"pdf"
|
||||
);
|
||||
$Format="png";
|
||||
$Format="pdf";
|
||||
|
||||
// Size
|
||||
$Sizes=array(
|
||||
|
||||
Reference in New Issue
Block a user