开发者

how to use pdf library in php?

开发者 https://www.devze.com 2023-01-29 20:21 出处:网络
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

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 en开发者_如何学Goable to execute the code ?


i suggest to you tcpdf. it was good for me. some feature:

  • no external libraries are required for the basic functions;

  • all standard page formats, custom page formats, custom margins and units of measure;

  • UTF-8 Unicode and Right-To-Left
    languages;


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..

0

精彩评论

暂无评论...
验证码 换一张
取 消