getCommand() public method

public getCommand ( ) : Command
return Command the command instance that executes pdftk
示例#1
0
 public function testSet40BitEncryption()
 {
     $document = $this->getDocument1();
     $file = $this->getOutFile();
     $pdf = new Pdf($document);
     $this->assertInstanceOf('mikehaertl\\pdftk\\Pdf', $pdf->passwordEncryption(40));
     $this->assertTrue($pdf->saveAs($file));
     $this->assertFileExists($file);
     $tmpFile = (string) $pdf->getTmpFile();
     $this->assertEquals("pdftk A='{$document}' output '{$tmpFile}' encrypt_40bit", (string) $pdf->getCommand());
 }
示例#2
0
文件: Pdf.php 项目: aviddv1/php-pdftk
 /**
  * @param string|Pdf $name the PDF filename or Pdf instance to add for processing
  * @param string|null $handle one or more uppercase letters A..Z to reference this file later.
  * If no handle is provided, an internal handle is autocreated, consuming the range Z..A
  * @param string|null $password the owner (or user) password if any
  * @return Pdf the pdf instance for method chaining
  */
 public function addFile($name, $handle = null, $password = null)
 {
     if ($handle === null) {
         $handle = $this->nextHandle();
     }
     if ($name instanceof Pdf) {
         // Keep a reference to the object to prevent unlinking
         $this->_pdf = $name;
         if (!$name->getCommand()->getExecuted()) {
             // @todo: Catch errors!
             $name->execute();
         }
         $name = (string) $name->getTmpFile();
     }
     $this->getCommand()->addFile($name, $handle, $password);
     return $this;
 }