public passwordEncryption ( integer $strength = 128 ) : |
||
$strength | integer | the password encryption strength. Default is 128 |
return | the pdf instance for method chaining |
public function passwordEncryption($strength = 128)
{
$this->getCommand()->addOption($strength == 128 ? 'encrypt_128bit' : 'encrypt_40bit');
return $this;
}
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()); }