Example #1
0
 /**
  * Runs the conversion.
  *
  * @throws ConverterException If a binary error occurred
  * @throws ConverterException If a shell error occurred
  * @throws ConverterException If no data was returned
  *
  * @return OutputInterface
  */
 public function convert()
 {
     $result = $this->executeShellCommand($this->buildCommand(), $this->input->getHtml());
     if (strpos(mb_strtolower($result['error']), 'error') !== false) {
         throw new ConverterException('Binary error: ' . $result['error']);
     }
     if ($result['result'] > 1) {
         throw new ConverterException('Shell error: ' . $result['result']);
     }
     if (mb_strlen($result['output']) === 0) {
         throw new ConverterException('No data returned');
     }
     $this->output->setPdfData($result['output']);
     return $this->output;
 }