Sunday 2 June 2013
Facebook StumbleUpon Twitter Google+ Pin It

PHP PDF Generate tutorial

PHP PDF Generate tutorial




Here is the tutorial for php pdf creation.
For this you need to download a file called fpdf.php

Basic Code to generate pdf in php

Take a look at the code, First you need to include the fpdf.php file using require()function.
after requiring the library file, we instantiate an object of the FPDF class and call it $pdf.
Then we add a page with the AddPage method, set our output font, define the cell (location) for our string of output, and then—using the Output method—display the PDF in the browser.
Output for the above code will be
php pdf

PHP PDF generate using cell

In the above code we’ve used cell method.
For the first text “PHP – The Good Parts!” we’ve given x=10 and y=10 and 0,0,’L’ denotes column, row and text alignment respectively.
So the output will be
php pdf

NOTE:

You may want to disable your browser’s caching capabilities while you are developing and testing the layout of your FPDF PDFs because some browsers will not reload the page with changes if the changes are so small that they don’t register as such with the cache control.

-By Parthiv Patel
Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

No comments: