예제 #1
0
 public function testDefaultOptions()
 {
     $options = new Options();
     $actualOptionArray = $options->toArray();
     $expectedOptionArray = ['format' => 'A4', 'orientation' => 'portrait', 'zoomFactor' => 1];
     $this->assertEquals($expectedOptionArray, $actualOptionArray);
 }
예제 #2
0
 /**
  * @param string $resourcePath
  * @param string $targetPath
  * @param \PhantomPdf\Options $options
  *
  * @return string
  */
 protected function createCommand($resourcePath, $targetPath, Options $options)
 {
     $commandLineOptions = implode(' ', $this->commandLineOptions);
     $optionArray = $options->toArray();
     $encodedOptions = escapeshellarg(json_encode($optionArray));
     $commandSegments = [];
     $commandSegments[] = $this->binaryPath;
     $commandSegments[] = $commandLineOptions;
     $commandSegments[] = __DIR__ . '/../js/phantom-pdf.js';
     $commandSegments[] = $resourcePath;
     $commandSegments[] = $targetPath;
     $commandSegments[] = $encodedOptions;
     return implode(' ', $commandSegments);
 }