mikehaertl\pdftk\Pdf::keepId PHP Method

keepId() public method

If not called, a new ID is created.
public keepId ( $id = 'first' ) : Pdf
return Pdf the pdf instance for method chaining
    public function keepId($id = 'first')
    {
        $this->getCommand()->addOption($id === 'first' ? 'keep_first_id' : 'keep_final_id');
        return $this;
    }

Usage Example

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