add page nos to existing pdf in php

Solutions on MaxInterview for add page nos to existing pdf in php by the best coders in the world

showing results for - "add page nos to existing pdf in php"
Marcel
15 Nov 2018
1<?php
2require_once('TCPDF/tcpdf.php');
3require_once('FPDI/fpdi.php');
4
5$pdf = new FPDI();
6
7$pdf->AddPage();
8
9$pdf->setSourceFile('existing_file.pdf');
10$tplIdx = $pdf->importPage(1);
11$pdf->useTemplate($tplIdx);
12
13$pdf->SetFont('Courier', '', 10);
14
15$pdf->SetXY(20, 10);
16$pdf->Write(0, "Text to be stamped");
17
18$pdf->Output("output_sample.pdf", "D");
19?>
20