mikehaertl\pdftk\Pdf::allow PHP Method

allow() public method

The available permissions are Printing, DegradedPrinting, ModifyContents, Assembly, CopyContents, ScreenReaders, ModifyAnnotations, FillIn, AllFeatures.
public allow ( string | null $permissions = null ) : Pdf
$permissions string | null list of space separated permissions or null for none.
return Pdf the pdf instance for method chaining
    public function allow($permissions = null)
    {
        $this->getCommand()->addOption('allow', $permissions, false);
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 public function testCanSetPermissions()
 {
     $document = $this->getDocument1();
     $file = $this->getOutFile();
     $pdf = new Pdf($document);
     $this->assertInstanceOf('mikehaertl\\pdftk\\Pdf', $pdf->allow('Assembly CopyContents'));
     $this->assertTrue($pdf->saveAs($file));
     $this->assertFileExists($file);
     $tmpFile = (string) $pdf->getTmpFile();
     $this->assertEquals("pdftk A='{$document}' output '{$tmpFile}' allow Assembly CopyContents", (string) $pdf->getCommand());
 }