Creation of PDF Document in PHP

Basic Graphic concept | PHP
The Web is more than just text. Images appear in the form of logos, buttons, photographs, charts, advertisements, and icons PHP supports graphics creation with the GD and Imlib2 extensions. In this article we will show you how to generate images dynamically with PHP, using GD extension.

Creation of PDF Document

FPDF is a PHP class that allows generating PDF files with PHP code. F from FPDF stands for Free: It is free to use and it does not require any API keys. you may use it for any kind of usage and modify it to user needs. 

Advantages of FPDF

Choice of measure unit, page format, and margins

Allow to set Page header and footer management

It provides an automatic line break, Page break, and text justification

It supports Images in various formats (JPEG, GIF)

It allows to setup Colors, Links, TrueType, Type and encoding support

It allows Page compression

Link to Download latest version of FPDF class:


Example:
<?php
require('fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->setFont('Arial','B',16);
$pdf->Cell(60,10,'cwipedia.in',1,1,'C');
$pdf->Output();
?>
Output:

Comments