Export
Overview #
One of the most important features in a reporting tools or framework is the ability to export report to other formats such as PDF. The exported file can be pushed to download from browser, attached to email or simply stored for later used.
For longtime, exporting HTML To PDF is quite difficult due to several reason. First, PDF is still behind browser in term of CSS supporting which makes modern version of CSS does not work in PDF like it does in browser. The same happens to HTML. Second, modern chart and graphs uses Javascript to render. Google Charts suite is a big example. That hinders the ability to include those beautiful charts into PDF.
This Export package solved those problems and more.
Features #
- Exporting your HTML report to PDF and common image formats (JPG, PNG, BMP ..)
- Fine-pixel printing report with different sizes: A3, A4, A5, Letter, Legal, Tabloid
- PDF paging supported with customized repeated header and footer text in each page. The page number and total number of page are supported as well.
- In-page Javascript supported. This means you can include any kind of modern charts such as Morris, D3, Sparkline. You name it, we support it!
- Exported file can be save to local drive or can be pushed to browser for user to download.
What can I do with this package? #
- Well, you can export your report and store for later usage.
- You can export to PDF and attach it to email and send to key persons every week.
- You can let user download your report in PDF or their preferred image file.
- You can create invoice in familiar HTML, export it to PDF then send to your customer. That's professional!
- There will be much more! We will update this list.
Installation #
By downloading .zip file #
- Download zip file from My Licenses
- Unzip
- Copy the folder
export
intokoolreport
folder, it will look like below - Download correct version of
phantomjs
for your OS intokoolreport/export/bin
folder
koolreport
├── core
├── export
By composer #
If you have purchased the package then you can follow these steps to install
- Login to koolreport.com
- Go to My Licenses
- Click Get Token For Composer button
- Copy the text and save to file
auth.json
next tocomposer.json
- Add the repositories to
composer.json
like below - Run
composer update
to install package - Download correct version of
phantomjs
for your OS intokoolreport/export/bin
folder
composer.json
{
"repositories":[
{"type":"composer","url":"https://repo.koolreport.com"}
],
"require":{
"koolreport/export":"*",
...
}
}
Your auth.json
will look like this:
{
"http-basic": {
"repo.koolreport.com": {
"username": "your@email.com",
"password": "your-secret-token"
}
}
}
Note: Please add your auth.json
to .gitignore
as it contains your secret login information.
Download phantomjs #
- Download PhantomJS execution file for operating system you are using:
- Window: phantomjs-2.1.1-windows.zip
- Linux: phantomjs-2.1.1-linux.zip
- MacOs: phantomjs-2.1.1-macosx.zip
- Unzip and put the execution file into the
koolreport/export/bin
folder
Installation Node.js and Chromium #
In case you want to use chrome headless to export to PDF, please follow these steps:
- Download the export package and unzip it.
- Copy the folder
export
into folderkoolreport/packages
- If you have admin right, download node.js from this link for your operating system https://nodejs.org/en/download/. Then install it on your server and go to folder
koolreport/packages/export
and run the following command line:npm i puppeteer
- If you can't install node.js on your server, please download the following portable node.js for your operating system and extract it to
koolreport/export
All done! Enjoy exporting your report with KoolReport now.
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.