setUserPassword() public method

public setUserPassword ( string $password ) : Pdf
$password string the user password to set on the output PDF
return Pdf the pdf instance for method chaining
Esempio n. 1
0
 public function testCanSetPasswords()
 {
     $document = $this->getDocument1();
     $file = $this->getOutFile();
     $pdf = new Pdf($document);
     $this->assertInstanceOf('mikehaertl\\pdftk\\Pdf', $pdf->setPassword('"\'**'));
     $this->assertInstanceOf('mikehaertl\\pdftk\\Pdf', $pdf->setUserPassword('**"\''));
     $this->assertTrue($pdf->saveAs($file));
     $this->assertFileExists($file);
     $tmpFile = (string) $pdf->getTmpFile();
     $this->assertEquals("pdftk A='{$document}' output '{$tmpFile}' owner_pw '\"'\\''**' user_pw '**\"'\\'''", (string) $pdf->getCommand());
 }