diff --git a/src/Jpg.php b/src/Jpg.php new file mode 100644 index 0000000..2cc9ee4 --- /dev/null +++ b/src/Jpg.php @@ -0,0 +1,46 @@ +file = $file; + $this->quality = $quality; + $this->progressive = $progressive; + } + + public function convert() + { + exec("pdftocairo -jpeg -jpegopt quality=$this->quality,progressive=$this->progressive -singlefile $this->file $this->file", $output, $returnVar); + + switch ($returnVar) { + case 1: + throw new OpenPDFException("Error opening PDF file: {$this->file}."); + break; + case 2: + throw new OpenOutputException(); + break; + case 3: + throw new PDFPermissionException(); + break; + case 99: + throw new OtherException(); + break; + default: + break; + } + + return $returnVar; + } +}