I have to add a watermark to my existing pdf file. I use fpdf and fpdi libraries.
My code is:
<?php
ob_start();
require('fpdf/fpdf.php');
require 'fpdi/fpdi.php';
$pdf = new FPDI();
$pdf->setSourceFile("Rabochaya_tetrad.pdf");
$tplIdx = $pdf->importPage(1, '/MediaBox');
$pdf->addPage();
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
$pdf->SetFont('Arial');
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY(58, 45);
$your_dynamic_content="file watermark";
$pdf->Write(0,$your_dynamic_content);
$pdf->Output();
ob_end_flush();
?>
When I try to perform it, I get an error:
FPDF error: Some data has already been output, can't send PDF file
I tried all advices from FPDF error: Some data has already been output, can't send PDF, but it didn't help me.
Do you have any ideas about these issues?