Watermark in PDF using a TEMPLATE

0

How can I make the watermark appear in a PDF that is generated through a TEMPLATE of the same PDF,

$pdf = new FPDI();

$pageCount = $pdf-> setSourceFile("FUMIGACION.pdf");

$tplIdx = $pdf->importPage(1);

$pdf->addPage();

$pdf->useTemplate($tplIdx);

I use the classes:

require_once('fpdf/fpdf.php');
require_once ('FPDI/fpdi.php');

and the "rotation.php" file

and with this gender the watermark, which if generated in a blank pdf, the problem is that when I add these lines and the method $pdf = new PDF(); nothing of the watermark is shown, but in a blank pdf if you show me the marac of water along with the image

class PDF extends PDF_Rotate {
function Header() {
    $imagenpdf = "firma_1.png";
    $marca="Fernando Hernandez";

    //imagen.. Ubicacion (X) ubicacion (y), ancho imagen, altura imagen, tipo de imagen
    $this->Image($imagenpdf ,90 ,180, 40 , 40,'PNG');
    //fuente del texto
    $this->SetFont('Arial', 'B', 30);
    //color del texto
    $this->SetTextColor(255, 189, 189);
    //ubicacion(X), Ubicacion TOP, rotacion(°)
    $this->RotatedText(35, 190, $marca, 20);
}

function RotatedText($x, $y, $txt, $angle) {
    $this->Rotate($angle, $x, $y);
    $this->Text($x, $y, $txt);
    $this->Rotate(0);
}
}

The problem arises when I use the object: $pdf = new FPDI(); to achieve the template of my base PDF, then it does not appear and if I remove this object, only the watermark appears and not the template.

Can someone tell me what I'm doing wrong or should I add / add?

Thank you in advance.

    
asked by Fernando 24.08.2017 в 19:04
source

0 answers