How to Use FPDF 2022

How to Use FPDF
How to Use FPDF – FPDF is a collection of PHP classes or libraries that can allow users to create PDF pages very easily.

And also without having to install additional modules again, for F, the name FPDF is an abbreviation that means Free.

Therefore, it becomes FPDF, can be downloaded, used, and can be developed freely.

FPDF can be downloaded for free via the following link: http://fpdf.org/en/download.php.

And also along with all the complete documentation via the following link: http://fpdf.org/en/doc/index.phpand there is also a documentation in Indonesian.

Creating a report is very important from a platform or application.

Applications that do not have a report function can make it difficult for users to be able to do a recap of the data or files contained in the application.

Usually, a very common report is in the form of Excel, PDF, or Word, but for this time we will share how to create a report in PHP using the FPDF library.

Creating a PDF report in PHP is now not so difficult, you can use a PDF library called FPDF, to be able to create a PDF report.

So how do you do it? Please just follow the steps on how to use FPDF to create a PDF report below.

How to Use FPDF

1. How to Use FPDF to Create PDF Reports Without Using Data From Database

How to Use FPDF
How to Use FPDF to Create PDF Reports Without Using Data From Database

For the first method, this is the simplest way to use FPDF.

So that on how to make a second report using data from the database, you will not find it difficult to read the script.

Go directly to the steps on how to use FPDF to create reports without using data from the database below:

  • Please download the FPDF library first via the following: FPDF libraries.
  • Then you create a new folder called exercisepdf in the htdocs folder page, after that you extract the FPDF file in the exercisepdf folder page earlier.
  • Then you create a new file, named index.php file, copy paste the script below, then save.
  • Please try to run it in a browser, after that type exercisepdf/localhost.
  • Finished.

2. How to Use FPDF to Create PDF Reports Using Data From Database

How to Use FPDF
How to Use FPDF to Create PDF Reports Using Data From Database

After you have successfully created a simple PDF report without using a database.

Now it’s time for you to create a report that is somewhat complex, just look at the step by step how to use FPDF to create a PDF report using the data from the following database:

1. Download and Extract

  • Please download the FPDF library first, via the following link FPDF libraries.
  • Then create a new folder, named exercisepdf in the htdocs folder page.
  • After that, extract the FPDF file in the training pdf folder page.

2. Create Databases and Tables

  • Please create a database named exercise, and you also create a table using the name pdf, and there is also a table structure.
  • Then don’t forget to fill in the created table with several records.

3. Create a New File Named report.php

  • Then you create a file called report.php.
  • After that, copy paste the script below, and add it to the report.php file as well. Next click save.
  • Then you just see the results, by opening a browser, then type localhost/report.pdf/practicepdf.
  • Finished.

The final word

Those are the two ways that are quite simple to be able to easily create a PDF file using FPDF.

As we explained above, making a report is very important from a platform or application

If you find it difficult to create a PDF report using FPDF, then you can follow the method above.

That’s all our discussion in this article about how to use FPDF. Hopefully useful and good luck.

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *