当在fpdf / fpdfi中使用现有模板时,仅显示文件的大小

How can I use existing template in fpdf. I have already used fpdi and can generate a pdf but the thing is, it didn't use the source file. It only display the size of the file and the additional text I have added. Here's the code I've tried:

public function template_trial(){

$this->load->library('fpdf'); 
$this->load->library('fpdi'); 

$pdf = new FPDI();
// add a page
$pdf->AddPage();
// set the source file
$pdf->setSourceFile("test.pdf");
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
// now write some text above the imported page
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'This is just a simple text');
$pdf->Output('tes.pdf','D');
}

sample text in pdf:

The file size of this PDF is only 12 KB. This is just a simple text

$mpdf = new mPDF('c','A4','','',11,10,20,10,10,10);
$mpdf->SetImportUse();
$mpdf->SetDocTemplate('layout_bb.compressed.pdf',true); // Add Template
$mpdf->AddPage();

$mpdf->allow_charset_conversion = true;
$mpdf->charset_in = 'utf-8';
$mpdf->WriteHTML($html); // Put my content on page
$mpdf->Output();