Beispiel #1
0
 public function process($input_file, $output_file = false, $format = ["pdf"], $parameters = [], $dataSource = '', $dataSourceParams = [], $background = true, $redirect_output = true)
 {
     if (is_null($input_file) || empty($input_file)) {
         throw new \Exception("No input file", 1);
     }
     if (is_array($format)) {
         foreach ($format as $key) {
             if (!in_array($key, $this->formats)) {
                 throw new \Exception("Invalid format!", 1);
             }
         }
     } else {
         if (!in_array($format, $this->formats)) {
             throw new \Exception("Invalid format!", 1);
         }
     }
     $cb = new CommandBuilder($this->executable);
     $this->theCommand = $cb->input($input_file)->output($output_file)->format($format)->addParams($parameters)->dataSource($dataSource)->query($dataSourceParams);
     $this->redirectOutput = $redirect_output;
     $this->background = $background;
     return $this;
 }