October 30, 2017
GREAT NEWS! We have released KoolReport 1.72.8 with some important enhancements: Table Pagination, DataStore Aggregation, new Filter's Operators and more.
Table Pagination
We have added the pagination feature to koolphp\Table
. To enable this feature, we only need to add "paging"
settings to the Table:
Table::create(array(
"paging"=>array(
"pageSize"=>10,
)
))
You may view example here.
DataStore Aggregation
We have added 4 new methods to DataStore: min()
, max()
, avg()
and sum()
. So in the case you want to get total of an specific column you may do:
$totalSaleAmount = $this->dataStore("sales")->sum("amount");
Filter's Operators
The Filter
process now has "in"
and "notIn"
operators. The "in"
works like the IN operators in SQL which accept only rows with column value within an array:
->pipe(new Filter(array(
array("firstName","in",array("Peter","Karl","David")),
)))
Bug fixes
We have fixed small bug in get()
method of DataStore
. In the previous version, the method returned wrong row. Issue has been fixed now.
KoolReport Pro
KoolReport Pro 1.5.0 has been released with latest core and extended packages. The packages updated in this version are Export 2.5.0, Inputs 2.7.0 and Pivot 2.2.0.
Reminder: Today is the last day of our promotion 30% OFF for KoolReport Pro. If you are interested in KoolReport Pro licenses, please purchase now before getting too late. Don't miss it!
<3 koolreport team
October 17, 2017
We are glad to let you know that we have released Export 2.0.0. In this version, we have solved one of the mysterious issues SSL Handshake.
SSL Handshake
In the previous version, we found that Export functionality works unstably with HTTPS protocols. Most of the cases, it works well. However in some cases, it does not load resources from HTTPS such as images, javascript, css. The SSL Handshake fails that causes interruption in loading those resources. We have solved the problem in this version. If you experience this issue, please upgrade.
Plan for next version
In the next version, we plan to make exporting job work without setting up a full report. In many cases, we just want to export a normal PHP page to PDF. We hope that by adding this new feature, the Export package will be more flexible and extensible in term of use case.
<3 koolreport team
October 17, 2017
This article guides you how to use KoolReport to convert any HTML to PDF even if the HTML is embedded with Javascript and CSS.
About KoolReport
KoolReport is an intuitive and open source PHP Reporting Framework. It is born to make task of building data reports easier and faster. It supports various database connections, powerful data processing and stunning data visualization.
PDF Exporting is one of the cool packages created for KoolReport. The package is built to support KoolReport in exporting reports to PDF. However it can be used for general purpose of converting HTML to PDF. What makes this exporting solution stand out is the ability to support embedded CSS and Javascript beside pure HTML.
Hand-on
Step 1: Create two files MyPage.php and MyPage.view.php
mypage/
├── MyPage.php
├── MyPage.view.php
└── index.php
The MyPage.php contains MyPage
class which is derived from KoolReport
.
<?php
require "../koolreport/autoload.php";
class MyPage extends \koolreport\KoolReport
{
use \koolreport\export\Exportable;
}
The MyPage.view.php is put in the same folder with MyPage.php. This view file contains your content in form of HTML, CSS and Javascript that you want to export.
<html>
<head>
<title>Content that you want to convert to PDF</title>
</head>
<body>
<!-- CSS Style -->
<style>
p {font-size:20px;}
h1 {color:red}
</style>
<!-- Normal HTML content -->
<h1>Export HTML to PDF</h1>
<p>It is easy to convert HTML to PDF using KoolReport's Export package</p>
<p id="extra"></p>
<!-- Javascript embedded -->
<script type="text/javascript">
document.getElementById("extra").innerHTML = "Javascript is working";
</script>
<body>
</html>
Step 2: Export To PDF
To generate PDF file and push to browser so that users can download, you do:
<?php
// index.php
require "MyPage.php";
$mypage = new MyPage;
$mypage->export()
->pdf(array(
"format"=>"A4",
"orientation"=>"portrait"
))
->toBrowser("mypage.pdf");
Easy, is it? And if you want to save the file instead of pushing to browser, you do:
<?php
// index.php
require "MyPage.php";
$mypage = new MyPage;
$mypage->export()
->pdf(array(
"format"=>"A4",
"orientation"=>"portrait"
))
->saveAs("../my_folder/mypage.pdf");
It is all done. Super easy!
Export package
In above example, we demonstrated how to export HTML embedded with CSS and Javascript to PDF. The ability to run Javascript is very important and is the feature that you may not find in other HTML to PDF solutions. This feature allows you to include any kinds of javascript-based charts into your exported PDF. Here is an good example of exporting Javascript Google Charts to PDF.
You may get Export package separately or purchase the bundle of all our commercial packages, KoolReport Pro.
<3 koolreport team
October 4, 2017
First of all, we would like to say thanks for using KoolReport. Your trust on us and our product is priceless. KoolReport team is working hard to create a good reporting framework so that reporting task becomes easier and more effective. We would like to ask for your reviews on KoolReport itself and its extended packages as well.
Write testimonials on forum
Please write your testimonials on our forum. You may write about how did you find us? How do you use KoolReport on your work? is it easy to learn and use? What features do you like best of KoolReport? And what features do you wish to have? Are you satisfied with the support? Do you recommend KoolReport to others? Sound too many questions! Basically you can write anything. We appreciate so much.
Write reviews on downloaded package
If you have downloaded a extended package, you may find the Reviews section at the end of each package page. There you can give us your comments and rating for the package.
Please help us
Your comments and reviews are very much appreciated. It will help us to see clearer the path that we took, how well we have done so far and where we should head to.
<3 koolreport team
October 3, 2017
Welcome to a new package, Instant 1.0.0. The package helps us to create Widget instantly everywhere without setting up a whole report.
Recently we have received a good suggestion that we should expand the usage of KoolReport's widget outside of KoolReport's environment. For example, to add Google BarChart to a normal php page. It is possible to setup a KoolReport class and the view and include the chart but it is quite troublesome and not convenient.
Understanding the need of creating ad-hoc charts and graphs, we created this package to make thing easier. Now you can build the below chart on the fly:
<?php
require_once "koolreport\autoload.php";
use \koolreport\instant\Widget;
use \koolreport\widgets\google\BarChart;
?>
<html>
<head>
<title>Instant BarChart</title>
</head>
<body>
<?php
Widget::create(BarChart::class,array(
"data"=>array(
array("name"=>"Peter","age"=>35),
array("name"=>"Karl","age"=>32),
)
));
?>
</body>
</html>
It's Free!
The package is totally free. So you may download it now!
<3 koolreport team