Php 8 Create Pdf File Using Fpdf Example





Php 8 Create Pdf File Using Fpdf Example

Hi guys,

Today i will explained How To Generate a pdf file in user data in php. This example is so easy to use in php. This example to i am perform to the generate user data through a pdf file.

This example to create a few other file to use. I am use to the fpdf generater in php to use in generate pdf file in php.

So let's start to the example.

Example :

Fpdf zip Dowload Link

I am add to the Fpdf file dowload link.Fpdf link


<!DOCTYPE html>

<html lang="en">


<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<title>Pdf Generate Form</title>

<link rel="stylesheet" href="">

<link rel="stylesheet" href="">

<script src=""></script>

<script src=""></script>

<script src=""></script>


.login-form {

width: 340px;

margin: 50px auto;

font-size: 15px;


.login-form form {

margin-bottom: 15px;

background: #f7f7f7;

box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);

padding: 30px;


.login-form h2 {

margin: 0 0 15px;


.form-control, .btn {

min-height: 38px;

border-radius: 2px;


.btn {

font-size: 15px;

font-weight: bold;





<div class="login-form">

<form name="frmUser" method="post" action="pdf.php" align="center">

<h2 class="text-center">Pdf Generate Form</h2>

<div class="message text-danger"><?php if($message!="") { echo $message; } ?></div>

<div class="form-group">

<input type="text" autocomplete="off" class="form-control" placeholder="Roll No" name="rollno">


<div class="form-group">

<input type="text" class="form-control" name="firstname" placeholder="First Name" autocomplete="off">


<div class="form-group">

<input type="text" class="form-control" name="lastname" placeholder="Last Name" autocomplete="off">


<div class="form-group">

<input type="email" class="form-control" name="email" placeholder="email" autocomplete="off">


<div class="form-group">

<button type="submit" class="btn btn-primary btn-block" value="Submit">Submit</button>








$rollno = $_POST['rollno'];

$firstname = $_POST['firstname'];

$lastname = $_POST['lastname'];

$email = $_POST['email'];


$pdf = new FPDF();



$pdf->Cell(0,10,"Registration Details",1,1,'C');

$pdf->Cell(20,10,"Roll No",1,0);

$pdf->Cell(45,10,"First Name",1,0);

$pdf->Cell(45,10,"Last Name",1,0);






$file = time().'.pdf';



now you can check your own.

i hope it can help you...

Recommended Posts