Reputation: 31
When i start it's showing this error
<?php
$p = PDF_new();
?>
Fatal error: Call to undefined function PDF_new() in D:\wamp\www\upload.php on line 2
I am using Wamp Server. I tried in XAMPP also. Is there any directives i have to enable to execute the code ?
Upvotes: 3
Views: 11273
Reputation: 7211
I think http://www.fpdf.org/ is the best PDF library for PHP. Download latest version from http://www.fpdf.org. Put this library folder on your root server or in your project. Create on test file named test.php & put below code in file as below.
<?php
include("fpdf/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',36);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
It will create one pdf file with contents "Hello World!" in it. You are done..
Upvotes: 3