Showing posts with label mPDF. Show all posts
Showing posts with label mPDF. Show all posts

Sunday, October 5, 2014

What is mPDF ?

mPDF is a PHP class which genarates PDF files from UTF-8 encoded HTML.It is based on FPDF and HTML2FPDF ,with a number of enhancements.




First we have to download mpDF.Download mpdf.

Then go to your project folder and put that mpdf file inside  /application/third_party/mpdf.



Then we have to create library file.
Go to /application/libraries/pdf.php





















Add this lines to the pdf.php file.Make sure to give the correct path (line:13) for mpdf.php file.


Then we have to call this library in controller.

This is my controller in here i have defined the logo and other details i have to display in this pdf file as well as you can see how to use database values.

pdfController:












We can set location where we need to genarate  pdf file.

Line 8:$pdfFilePath = FCPATH."downloads\GoBuyAndSell.pdf";

Genarated PDF File:



Wednesday, September 17, 2014

Add PDF,CSV,EXCEL buttons to generate file formats.




By clicking copy,csv,excel,pdf and print you can get table data according to selected button.
First we have to download datatable tools.

Add downloaded files to your project folder.
After that you have to add below links to your view.

View:






next we can create table.In this example I get data from database table and display that data in grid view.

View:












Controller:





Model: 








JavaScript:
In here we have to set the path for copy_csv_xls_pdf.swf file according to your project you have set the path were copy_csv_xls_pdf.swf file is located.