mikehaertl\pdftk\Pdf::passwordEncryption PHP 메소드

passwordEncryption() 공개 메소드

public passwordEncryption ( integer $strength = 128 ) : Pdf
$strength integer the password encryption strength. Default is 128
리턴 Pdf the pdf instance for method chaining
    public function passwordEncryption($strength = 128)
    {
        $this->getCommand()->addOption($strength == 128 ? 'encrypt_128bit' : 'encrypt_40bit');
        return $this;
    }

Usage Example

예제 #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());
 }