PDF Generation using FPDF in PHP

 FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. It is free to use and it does not require any API keys. FPDF stands for Free PDF. It means that any kind of modification can be done in PDF files.

Feature - 

- Choice of measure unit, page format and margins

- Page header and footer management

- Automatic page break

- Automatic line break and text justification

- Image support (JPEG, PNG and GIF)

- Colors

- Links

- TrueType, Type1 and encoding support

- Page compression

PHP-FPDF Code for PDF Generation - 

This code is used to generate PDF for displaying text file data. Download FPDF to execute this script.

<?php

require('fpdf/fpdf.php');

$pdf = new FPDF();

$pdf->AddPage();

$row=file('abc.txt');

$pdf->SetFont('Arial','B',12);

foreach($row as $rowValue) {

$data=explode(';',$rowValue);

foreach($data as $columnValue)

$pdf->Cell(90,12,$columnValue,1);

$pdf->SetFont('Arial','',12);

$pdf->Ln();

}

$pdf->Output();

?>

2 comments:

Ishita Jack said...

Glad to visit this blog, really helpful. Gathered lots of information and waiting to see more updates.
PHP website development
PHP Web Development Tools
PHP Trends

Ishita Jack said...

Glad to visit this blog, really helpful. Gathered lots of information and waiting to see more updates.
PHP website development

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...