add page nos. to existing pdf in php
<?php
require_once('TCPDF/tcpdf.php');
require_once('FPDI/fpdi.php');
$pdf = new FPDI();
$pdf->AddPage();
$pdf->setSourceFile('existing_file.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetFont('Courier', '', 10);
$pdf->SetXY(20, 10);
$pdf->Write(0, "Text to be stamped");
$pdf->Output("output_sample.pdf", "D");
?>