revision = $rev; } public function run() { $ocr = OCR::find([["revision", "=", $this->revision]])->first(); if (!$ocr) { $ocr = new OCR; $ocr->revision = $this->revision; $ocr->save(); } $this->status("Processing"); $rev = new Revision($this->revision); $pdf = $rev->getPDF(); $text = $pdf->text()->get_text(); print("[" . $text . "]\n"); if ($text == "") { $this->status("Running OCR on PDF"); $newpdf = new PDF($pdf->parent() . "/ocr.pdf"); $pdf->ocr($newpdf); $text = $newpdf->text()->get_text(); } $ocr->body = $text; $ocr->save(); $j = new IndexJob($this->revision); $j->queue(); $this->status("Complete"); $this->finish(); } }