public function transcode($input, $format, $outputFile, $pageRange = null)
    {
        if (!file_exists($input)) {
            throw new InvalidFileArgumentException(sprintf('File %s does not exists', $input));
        }

        $arguments = array(
            '--format=' . $format,
            '--stdout'
        );

        if (preg_match('/\d+-\d+/', $pageRange)) {
            $arguments[] = '-e';
            $arguments[] = 'PageRange=' . $pageRange;
        }

        $arguments[] = $input;

        try {
            $output = $this->command($arguments);
        } catch (ExecutionFailureException $e) {
            throw new RuntimeException(
                'Unoconv failed to transcode file', $e->getCode(), $e
            );
        }

        if (!is_writable(dirname($outputFile)) || !file_put_contents($outputFile, $output)) {
            throw new RuntimeException(sprintf(
                'Unable to write to output file `%s`', $outputFile
            ));
        }

        return $this;
    }