I am trying to adding text in existing pdf using fpdi with tcpdf library. but text are not showing on the pdf. if i search pdf text can be highlighted but it is hidden on pdf. i have tried z-index too but still not appear.
please see below is my code.
$pdf = new FPDI();
$pageCount = $pdf->setSourceFile('102215_2019_unlocked.pdf');
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
$templateId = $pdf->importPage($pageNo);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
//$pdf->setPrintHeader(false);
// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) {
$pdf->AddPage('L', array($size['w'], $size['h']));
// Font size 1/3 Height if it landscape
$fontsize = $size['h'] / 3;
} else {
$pdf->AddPage('P', array($size['w'], $size['h']));
// Font size 1/3 Width if it portrait
$fontsize = $size['w'] / 3;
}
$html = '<h1 style="z-index:-1;color:black;">[![HTML Example][1]][1]</h1>';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->useTemplate($templateId);
// $pdf->SetAlpha(1);
}
$pdf->output();