mikehaertl\wkhtmlto\Pdf::getCommand PHP Method

getCommand() public method

public getCommand ( ) : Command
return Command the command instance that executes wkhtmltopdf
    public function getCommand()
    {
        if ($this->_command === null) {
            $options = $this->commandOptions;
            if (!isset($options['command'])) {
                $options['command'] = $this->binary;
            }
            $this->_command = new Command($options);
        }
        return $this->_command;
    }

Usage Example

Beispiel #1
0
 public function testCanUseXvfbRun()
 {
     $inFile = $this->getHtmlAsset();
     $outFile = $this->getOutFile();
     $binary = $this->getBinary();
     $pdf = new Pdf(array('binary' => $binary, 'commandOptions' => array('enableXvfb' => true)));
     $this->assertInstanceOf('mikehaertl\\wkhtmlto\\Pdf', $pdf->addPage($inFile));
     $this->assertTrue($pdf->saveAs($outFile));
     $tmpFile = $pdf->getPdfFilename();
     $this->assertEquals("xvfb-run -a --server-args=\"-screen 0, 1024x768x24\" {$binary} '{$inFile}' '{$tmpFile}'", (string) $pdf->getCommand());
     unlink($outFile);
 }