takes PDFs and runs OCRmyPDF on them
More...
takes PDFs and runs OCRmyPDF on them
Definition at line 10 of file ppyrd.scanner.php.
pdfScanner::__construct |
( |
|
$pdf, |
|
|
|
$db |
|
) |
| |
constructor taking care of setup
Definition at line 15 of file ppyrd.scanner.php.
19 $this->tesseractCommand = $this->db->getConfigValue(
'tesseractCommand');
function executing main logic
Definition at line 25 of file ppyrd.scanner.php.
27 $this->
output(
"executing on " . $this->pdf);
30 $fp = fopen(
'/tmp/ppyrdOcrMyPdf.txt',
'w+');
33 if(flock($fp, LOCK_EX))
36 exec($this->tesseractCommand .
" '" . $this->pdf .
"' '/data/inbox/" . $this->pdf .
"'");
37 if (file_exists(
"/data/inbox/" . $this->pdf))
40 $this->
output(
"fixing permissions");
41 exec (
"user_id=$(stat -c '%u:%g' " . $this->pdf .
'); chown $user_id /data/inbox/' . $this->pdf);
42 $this->
output(
"found ok OCR - moving input to archive");
43 exec(
"mv --backup=numbered '" . $this->pdf .
"' '/data/scan/archive/" . $this->pdf .
"'");
46 $this->
output(
"did not find ok OCR - moving input to error");
47 exec(
"mv --backup=numbered '" . $this->pdf .
"' '/data/scan/error/" . $this->pdf .
"'");
53 $this->
output(
"OcrMyPdf still running - cannot interfere with it ... if this persists too long check /tmp/ppyrOcrMyPdf.txt and delete");
output($string, $debug=0)
outputs string
The documentation for this class was generated from the following file: