|Ratings|| ||Unique User Downloads|| ||Download Rankings|
| 43%||Total: 7,799 ||All time: 226 This week: 122|
This class can be used to generate a PDF document from the results of MySQL database queries.
The class can execute one or more given queries and generate dump the results as HTML tables to a temporary page file.
The PDF document is generated by calling a remote Web service that fetches the generated HTML page and convert it to the PDF format.
* SQL2PDFReport Generator Class
* @author : MA Razzaque Rupom <email@example.com>, <firstname.lastname@example.org>
* Moderator, phpResource Group(http://groups.yahoo.com/group/phpresource/)
* URL: http://www.rupom.info
* @version : 1.0
* @date 06/05/2006 (modified on 06/23/2006)
* Purpose : Generating Pdf Report from SQL Query
//make sure the DB connection is ok
//queries whose output will be used as report data
$query_1 = "SELECT * FROM book";
$query_2 = "SELECT title,author FROM book";
$query_3 = "SELECT book_id,publisher,reader FROM book";
$obj = new Sql2PdfReport();
//sets absolute path where temporary report HTML file will be saved (should be under doc_root so that its URL can be set)
$obj->setHtmlPath("/projects/rupom/phpclasses/sql2pdfreport/first_test.html"); //change this according to your Path
//sets URL of the temporary report HTML file
$obj->setHtmlUrl("http://localhost/phpclasses/sql2pdfreport/first_test.html");//change this according to your URL
//inits row colors. colors will be repeated automatically
//generates report from $query_1
//changes row colors for the second report.
//generates report from $query_2 and appends it to previous report data
//generates report from $query_3 and appends it to previous report data
$pdfVersion = '1.4'; //change it according to your need
$pdfVersion = 1.3 for Acrobat Reader 4
$pdfVersion = 1.4 for Acrobat Reader 5
$pdfVersion = 1.5 for Acrobat Reader 6
//sets PDF version
//gets the pdf report of all the report data
This class generates PDF Report from SQL query.
Here's how it works:
Executes given query and generates HTML report first
Appends query reports to previous report(if any)
Creates a temporary HTML file and store that as HTML report
Creates PDF report for that HTML report by using remote application
For Remote PDF Application, I have used html2ps and html2pdf (supplied by http://www.tufat.com/script19.htm).
It is 100% FREE for commercial AND non-commercial use! It renders pages as PDF documents and PostScript files.
I have deployed this application to phpResource(http://groups.yahoo.com/group/phpresource/) group's server
for easy and reliable access. My special thanks goes to phpResource group.
I am a hardcore C/C++ and PHP programmer. I enjoy my times in implementing varities of freelancing works.
Please rate this class if you like and if it comes to your needs. Please feel free to contact me for
any suggestion and/or further assistance regarding the technique and its implementation.
MA Razzaque Rupom
Moderator, phpResource Group
My Blog : http://www.rupom.info
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
||Pages that reference this package
Latest pages that reference packages