The KoolReport Blog

Announcements, discussions, and more for KoolReport and its extended packages.

KoolReport v1.15.4

Let party again! We have released KoolReport version 1.15.4 with several important updates including resource managements, event handling mechanism.

The big added feature in this version is the report resource management. In the previous version of KoolReport, each widget renders its own resources including css and js. This was great however it causes a problem of duplication. For example, a report has two google charts, it happens that google chart loader will be called twice. That is a big waste. It leads us to the solution of having a manager in between to manage all resources. ResourceManager class has been created and each report will have this manager. To get it, we will call $report->getResourceManager(). The ResourceManager has some important functionalities:

  1. Register a script file to the view at begin or at end.
  2. Add a custom js script to run at begin or at end.
  3. Register a css file
  4. Add custom css style to page
  5. Detect and eliminate the duplication of resource.

The second improvement is the event handling mechanism. There are two new methods added to KoolReport class: registerEvent() and fireEvent(). When something happens, KoolReport or its components (datasource,process or widget) can fire an event. For example, when KoolReport start to run, it will fire event OnBeforeRun. The event can be registered to be listened. For example an component can register event OnBeforeRun of KoolReport to take extra preparation actions for itself. This event handling mechanism is very important for KoolReport and its components to work together.

Alright, there are many small other enhancements but two above are the biggest ones. Ultimately, we want KoolReport to be the best reporting framework in the world. It may sound crazy but no one taxes your dream. If we have to think anyway, why not think big. We may fail to land on the star, we will be somewhere near the moon.

All the best.

P/S: Follow us on our twitter to get latest news, join discussion on our forum. If you know someone who need to make report, tell them about KoolReport. They will love you, we guarantee.

<3 koolreport team.

How to Export Your Report with Html+Css+Javascript to PDF?

"For a long time, I have looked for but did not find a good solution to export HTML embedded CSS and Javascript to PDF" - John Marshall, one of our customers.

Exporting HTML+CSS+JS to PDF Fig 1: KoolReport converts HTML+CSS+JS to PDF

The problem of John is a common problem of developers working with PDF. We have worked with many PDF libraries such as TCPDF, FPDF, html2pdf or dompdf and we encounter some problems:

  1. It is not intuitive. If you use FPDF or TCPDF, you will feel quite difficult to write content, set style and position element with pure PHP code only. The Html2Pdf and DomPDF provide a better solution which is converting HTML to PDF but they have second problem.
  2. Low level of HTML/CSS support. This problem is associate with Html2Pdf and DomPdf. In those libraries, You should not use the latest HTML or CSS because they will not be rendered all correctly. Always be careful. Sometime the code breaks, things are not displayed in PDF and it takes a lot of time to debug and find a work around in lower level of HTML/CSS.
  3. Javascript is not supported. Uhh! All of them have this issue. Javascript now is the base of many chart libraries. Google Charts, Morris, D3, Sparkline, all of them are using Javascript to generate charts and graphs. So using pure HTML to PDF solution, we must forget all those beautiful charts.

So we was trying to find solution for above problems, a library that we can write PDF file easily with latest HTML/CSS combined with Javascript. And it is now all possible with Export package of KoolReport.

Some simple code to show

This is the view MyReport.view.php

<html>
    <body style="margin: 1in">
        <div class="page-header">My sample report</div>
        <h1>Welcome to KoolReport</h1>
        <div class="page-footer">{pageNum}</div>
    <body>
</html>

This shows how to initiate KoolReport and export to PDF.

<?php
$report = new MyReport;
$report->run();
$report->export()->pdf()->saveAs("MyReport.pdf");

Working example

Let example speaks for itself. Below is a working example of exporting a HTML page with embedded Google Charts.

Example of exporting HTML to PDF

Additional features:

Beside the crucial features above, the Export package supports other necessary settings:

  1. Set page size with predefined size (A3, A4, Letter etc..) or any custom size in px
  2. Set page orientation (portrait or landscape)
  3. Set page margin
  4. Input repeated header text and footer text on each page
  5. Show page number as well as number of pages.

For more information on features and documentation, please visit Export Package.

Summary

Export package is an excellent solution for exporting report to PDF and other formats. Not only can it be used for exporting report, it can help you to export any kind of HTML page to PDF with ease. The price of package is low compared to the benefits it brings to you.

If you have any question regarding this package, do not hesitate to join our forum to get answer. We are happy to assist you.

<3 koolreport team

KoolReport v1.11.4

Let party! We have released KoolReport v1.11.4 with many enhancements, one-step closer to be the best reporting tools and framework for PHP.

Party for great PHP Reporting Tools

We have added a new datasource called ReportDataSource. This datasource allows us to pull data from another report. For example, we have HardwareSaleReport and SoftwareSaleReport ready to run. Now we want to make TotalSaleReport which is the summary of both hardware and software sale, we do not need to duplicate works to query again hardware and software sale number from database. Rather, we will pull data from existed report which are HardwareSaleReport and SoftwareSaleReport. Life is easier, isn't it.

We have enhanced the Google Chart library. Recently Google has update some of charts, moving it from "upcoming" zone to "current", meaning those charts are ready for production. We have updated that. Moreover, some of bugs such as number in column header causing google charts to stop rendering have been solved. Not forget to mention, we enable "role" settings for columns in Google Charts. If you have used the Google Chart before, the column "role" is important to set annotation, certainty, tooltip, emphasis and more in chart.

We have improved the data processing as well:

  1. CalculatedColumn now can be set custom function and meta data
  2. Filter now supports OR operator
  3. ValueMap can set custom function to support more complicated transformation of value

Last but not least, one of the crucial enhancement in this version is the memory usage. We have improve the ExcelDataSource, CSVDataSource to reduce the temporarily stored data and still complete task effectively. The same enhancement goes for DataStore.

Here is the full list of enhancements and bug fixed.

Enjoy new version!

If you like KoolReport, please share with others!

<3 koolreport team

KoolReport v1.0.0

Finally the KoolReport first version has come. Although there is still so much work to do but let take a break and breath the first achievement.

KoolReport Team

Here are some highlights:

  1. Finalize the neuron data flow structure. In this structure, data after processed in a node can be piped to many other nodes to further process. Moreover, a node can receive data from many source nodes. In our examples, we shows a simple processing steps: (datasource) -> (filter) -> (group) -> (datastore). This is just the most simple flow can be done by KoolReport.
  2. Build the most common used data sources. Most of time, we use RDBMS such as MySQL, Oracle or SQL Server etc. We make the PDODataSource as the default data source to handle those databases. Beside we included MongoDBDataSource to connect to most used NoSQL database MongoDB. The next common used sources are CSV or Excel. We provided CSVDataSource and ExcelDataSource for connecting convenient.
  3. Build the most common data processing.
  4. Build the wrapped widgets for Google Charts library. Google Charts is awesome free library for charting.
  5. Made the first extended package called Cube which helps to turn data into cross-tab table. This helps us to answer the question "What is the summarized sale amount on each product on each customer?".

Please give us your feedback on KoolReport: opinion, questions, features you want, anything. We strongly believed that it will help us to improve the framework.

Next plan

Some things that we are doing right now

  1. Prepare to release package called 'Export'. This package will allow us to export to pixel perfect report in format of PDF, DOCX and others. Exporting, printing is always in important part of reporting. We understand that.
  2. Make Pivot process: Allow us to view data in multi-dimension.
  3. Allow authors can create extended packages in our packages store.
  4. Build forums for discussions, Q&A, bug reports and others.

All for now, thank you very much and wish you have a good day.

P.S: If you like KoolReport and what we are doing, please share it.

<3 koolreport team.


KoolReport helps to analyze your data and ultimately turn them into visual reports or dynamic dashboards.

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"

Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great product and amazing."

Dr. Lew Choy Onn

"Fantastic framework for reporting!"

Greg Schneider
Get KoolReport Now, It's FREE!