mikehaertl\pdftk\Pdf::multiBackground PHP Method

multiBackground() public method

If $file has fewer pages than the PDF file then the last page is repeated as background.
public multiBackground ( string $file ) : Pdf
$file string name of the background PDF file.
return Pdf the pdf instance for method chaining
    public function multiBackground($file)
    {
        $this->getCommand()->setOperation('multibackground')->setOperationArgument($file, true);
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 public function testCanSetMultiBackground()
 {
     $document1 = $this->getDocument1();
     $document2 = $this->getDocument2();
     $file = $this->getOutFile();
     $pdf = new Pdf($document1);
     $this->assertInstanceOf('mikehaertl\\pdftk\\Pdf', $pdf->multiBackground($document2));
     $this->assertTrue($pdf->saveAs($file));
     $this->assertFileExists($file);
     $tmpFile = (string) $pdf->getTmpFile();
     $this->assertEquals("pdftk A='{$document1}' multibackground '{$document2}' output '{$tmpFile}'", (string) $pdf->getCommand());
 }