protected function generatePdf($view)
    {
        $view = $this->viewToString($view);
        $this->saveHtml($view);

        $command = implode(' ', [
            $this->getBinaryPath(),
            implode(' ', $this->commandLineOptions),
            $this->convertScript,
            $this->prefixHtmlPath($this->htmlPath),
            $this->pdfPath,
            implode(' ', $this->commandLineArguments),
        ]);

        $process = new Process($command, __DIR__);
        $process->setTimeout($this->timeout);
        $process->run();

        if ($errorOutput = $process->getErrorOutput()) {
            throw new RuntimeException('PhantomJS: ' . $errorOutput);
        }

        // Remove temporary html file
        @unlink($this->htmlPath);
    }