I am working on a website where I have to generate PDF certificates, So far I am trying to add text and Image on the same page using FPDF in PHP, I am able to add a single image,but the moment I add a line of text some error pops in and Page goes blank. This page gives error. Error in the sense I get a blank page with no output Or pdf opened on it.
<?php
require('fpdf.php');
if(isset($_POST["Submit"]))
{
//create image from text
$text = $_POST["name"];
$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image('head.jpg',0, 0, 210,100,'PNG');
$pdf->SetFont('Arial', '', 12);
$pdf->Text(105,68,"$text");
$pdf->Image('foot.jpg',0, 110, 210,100,'PNG');
$pdf->Output();
}
?>
But if I do this pdf is generated successfully with a image on it.
<?php
require('fpdf.php');
if(isset($_POST["Submit"]))
{
//create image from text
$text = $_POST["name"];
$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image('head.jpg',0, 0, 210,100,'PNG');
//$pdf->SetFont('Arial', '', 12);
//$pdf->Text(105,68,"$text");
$pdf->Image('foot.jpg',0, 110, 210,100,'PNG');
$pdf->Output();
}
?>