public function pdf($config = [])
    {
        if (!isset($config['url']) && !isset($config['html'])) {
            throw new \Exception('URL or HTML in configuration required', 400);
        }
        $tempFile = null;
        if (!isset($config['pdf']['path'])) {
            $tempFile = tempnam(sys_get_temp_dir(), 'pdf-');
            $this->config['pdf']['path'] = $tempFile;
        }
        // default PDF configuration
        $this->config['pdf']['format'] = 'A4';
        $this->config['pdf']['printBackground'] = true;
        
        $this->config = self::merge($this->config, $config);
        $fullCommand = $this->path.' ' .$this->nodePath.' ' .$this->nodeBinary.' '
            .escapeshellarg($this->executable). ' ' .escapeshellarg(json_encode($this->config));
            
        if ($this->isDebug) {
            $fullCommand .= " 2>&1";
        }
        exec($fullCommand, $output, $returnVal);
        $result = [
            'ouput' => $output,
            'returnVal' => $returnVal
        ];
        if ($returnVal == 0 && isset($tempFile)) {
            $data = file_get_contents($this->config['pdf']['path']);
            unlink($this->config['pdf']['path']);
            return $data;
        }
        
        return $result;
    }