How To Create PDF Receipt Note using FPDF Library

PHP tutorial how to create a PDF receipt note using FPDF library. Continuing my tutorial “Create a Sales Form / POS – Tutorial Build Point Of Sale With PHP, PDO, MySQL And Jquery“, I promise to share how to create a PDF note receipt as a bonus article. A visitor of this website has reminded me of bonus articles (Thank you, Greg, for reminding me :)). Let’s follow my tutorial below.

If you are creating a point of sale apps, it should have the feature to print the note receipt on the sales module. One alternative to making a note on PHP is to use a PDF file. With the help of FPDF library, we can create PDF files easily. But for the receipt note is slightly different, the receipt note has a smaller size and more complicated content.

Read another article: Trick How To Print Report Without Open New Tab Page With Javascript

I have created a PHP script to print notes in a simple PDF form. This simple script you can develop yourself as you wish. As an illustration of the receipt structure, I created as shown below

PHP Tutorial How To Create Receipt Note Pdf With PHP

Let’s start the tutorial

PHP Tutorial How To Create Receipt Note PDF With FPDF Library

As an experimental material, we need to prepare some basic materials for this example to work properly.

  1. Of course, we need a database that we created earlier in the tutorial “Create a Sales Form / POS – Tutorial Build Point Of Sale With PHP, PDO, MySQL, And Jquery.
  2. Add sales data using following MYSQL script as material to create PDF note
  3. I usually use jQuery Redirect library to request “POST” data quickly. Please download the library here
  4. Create a PHP file named printnote.php and copy the following script
  5. Download FPDF library here
  6. Edit the FPDF library and add a new paper type called “struck.” Change the following code in FPDF.php:
  7. Create a PHP file with the name struck.php and copy the following code:

Save and run the script above. Then the application will run like the following video

To Download the entire project, please share this article from button below to open the download link

So my article on PHPtutorial how to create a PDF receipt note using FPHP, hopefully, useful

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

2 Comments

 Add your comment
  1. Thanks so much Sigit.
    Your site help me to refresh and learn new programming techniques and skills.
    Best Regards,

    Greg

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.