
Introduction
PDF stands for Portable Document File
In 1991, Adobe co-founder Dr John Warnock launched the paper-to-digital revolution with an idea he called, The Camelot Project. The goal was to enable anyone to capture documents from any application, send electronic versions of these documents anywhere and view and print them on any machine. By 1992, Camelot had developed into PDF. Today, it is the file format trusted by businesses around the world.
Source – Adobe.com
How to create Pdf documents in PHP
PHP is one of the most popular backend scripting languages, with more than 70% of Entire Websites built on it.
To create pdf documents, we’ll use the pdf creation library fpdf
Download & Extract FPDF library
Go to the official website of FPDF & download the zip in your preferred language.

Basic Hello World Example
Create a file hello-world.php and add the following code to it-
<?php
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
When you run the above code, pdf file with hello world text will be downloaded.
Adding Image to PDF with FPDF
You can also add images in your pdf file, just use the code below-
// Insert a logo in the top-left corner at 300 dpi by passing relative url of file
$pdf->Image('logo.png',10,10,-300);
// Insert a dynamic image from a URL
$pdf->Image('http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World',60,30,90,0,'PNG');