What are the differences between fpdf, fpdi, and tcpdf in terms of functionality and usage?

The main differences between fpdf, fpdi, and tcpdf are that fpdf is a basic library for creating PDFs, fpdi is used for importing existing PDFs into fpdf, and tcpdf is a more advanced library with additional features for creating PDFs. To use fpdi to import an existing PDF into fpdf, you can use the following code snippet:

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

$pdf = new FPDI();
$pdf->AddPage();
$pdf->setSourceFile("existing_pdf.pdf");
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 10, 10, 100);

$pdf->Output();