The PDF file must have a transparent background for the watermark to be visible.
public background ( string $file ) : |
||
$file | string | name of the background PDF file. Only the first page is used. |
Результат | the pdf instance for method chaining |
public function testCanSetBackground() { $document1 = $this->getDocument1(); $document2 = $this->getDocument2(); $file = $this->getOutFile(); $pdf = new Pdf($document1); $this->assertInstanceOf('mikehaertl\\pdftk\\Pdf', $pdf->background($document2)); $this->assertTrue($pdf->saveAs($file)); $this->assertFileExists($file); $tmpFile = (string) $pdf->getTmpFile(); $this->assertEquals("pdftk A='{$document1}' background '{$document2}' output '{$tmpFile}'", (string) $pdf->getCommand()); }