Yii with generating and printing reports, charts etc.

I have not seen any relevant summarizing article in forum or cookbook about extensions or methods about generating reports, charts etc.(e.g. from models, xml or other provided data) and preparing them to be printed.

In this article please specify your experience (extensions, your own code, print button realization, etc.) in all above mentioned when generating user relevant data (reports, charts) from models, and/or preparing them for printing.

This list will be updated after your comments:

Charting with Yii:

  1. Yii Open Flash Chart 2 Extension [feedback: very nice implementation and authors contribution - examples of using data from external sources(model, xml schema, etc.) would be greatly valuable]

  2. Fusion Charts API Extension - Create and share Charts

  3. Flot - EFlot plotting library encapsulation

  4. Jqplot - extension of jqplot for charts

  5. Cvisualizewidget - This widget makes it easy to render charts and graphs within your web application by utilising the visualize jQuery plugin.

  6. Highcharts Extension

Printing, generating pdf, xls, cvs etc. with Yii:

  1. Generating PDF with - tcpdf needs to be rechecked as it does not work properly…

  2. Simple Yii extension printout for .datagrid and other .css elements printing - please offer your favourite extension usage methods

  3. Yii CSV generator csvout See installation issues

  4. Generating PDF with pdflib see topic

  5. phpexcel-codeplex by sharehua

  6. Print what you see - mprint by macinville

Relevant topic here

Additional data generation, aggregation, grouping extensions and methods:

Please offer your solutions and specify additional categories relevant to this topic.

All your contribution to this topic should be put in cookbook

i modify CVSOUT and generate excel with PHPExcel. but only did that

I am interested in the topic

Grouping, Paging, headers, footers …

here more links http://phpreports.sourceforge.net/


This is an old one originally released for PHP3 around 2000 and updated over the years.


That’s very good modification. Could you put it somewhere to be downloadable for other members?

yes, of course

but i’m new in php and yii.

probably will have to be modify the code for create a good extension for all members

help me please


Seems the attachment file is broken - could not extract.

I do not know what is happening.

bug in forum?

I can not attach tar.gz

try with zip file


you must download PHPExcel an d put in extension folder

Hey all,

What news do you have in this topic?

I saw new extension up rise here Fusion Charts API ext - Create and share Charts

Best regards,


New extension for Yii - Flot:


This extension encapsulates the jQuery flot graph library see flot

Samples here

Best regards,


Added two new charting extensions:





Best regards,


One new extension coming up to Excel :)


phpexcel-codeplex port by sharehua



Good job CoLT


CoLT, great topic. Here is another new extension you may want to add to the list.

Highcharts Extension

Compared to the other JavaScript charting libraries (Flot, jqPlot), Highcharts requires a more verbose configuration but also produces higher quality (animated) graphs, supports more advanced options without plugins, and uses only a single JavaScript file.

Hi All,

Today I found something that make my day :)

please find mpdf at MPDF

Hope make our lives got better.

If you think this info is usefull please GRP (are there any ?) :rolleyes:

I’m currently doing a project which requires generating graphic reports for printing, so I decided to generate PDFs to allow people easy printing.

For this I’ve downloaded TCPDF and am experimenting with it. I didn’t like the existing Yii extension for it, so I wrote my own to encapsulate TCPDF as an application component, and it’s working so far. I’ll upload it when I’ve finished if people are interested.

Of course, its great to have full community impact in the Yii’s growing extension library!



One more goes for Printing ;) mprint



Here is an open source library which I think would be a great graphing library once wrapped into an extension.

website: dygraphs dot com or the source is here https github dot com/danvk/dygraphs

I have no idea yet on how to make it into an exension yet, but thought I would throw it out there, since I did not see anyone mention it.


Ok, I’ve finished my project involving generating Pdf reports, so as promised, here is what I used - 1592


I’ve basically just made a wrapper to transform TCPdf into a Yii component with autoloading goodness.

There is a component class file which allows you to set options and paths in your main.php config file, and an example TCPDF class extension file that you can use, or replace with your own custom one (at the very least you’ll want to modify/extend it to implement your own page headers and footers).

My experience with TCPdf is that it is a beast. Most of the code is in a >1Mb class file, and depending on what you’re doing, generating Pdf files can be slow (although in my case it wasn’t too bad - I didn’t have much content per document).

I didn’t make much use of the Html conversion functions (although the whole class seems to be geared to Html conversion anyway), but from what I’ve read, using big chunks of Html as source can make things quite slow.

All in all, TCPdf is obviously very useful - it is quite powerful, and of course it is free!

However, while I’m certain that a lot of clever code has gone into it, I didn’t think much to the coding. Coding standards are not too good, and the whole thing is not very readable. I found myself adding getters in my extension class, because there were a lot of setters that had no counterpart getter (which you’ll need, for example, if you want to change margin sizes for something in particular, and then reset them back to what they were, without having to hard-code those sizes).

I think the whole thing could do with rewriting the Yii way (not necessarily for inclusion in Yii, just because it is so much clearer and cleaner). Proper use of getters and setters would be good, and using arrays to pass options into functions a la Yii (rather than some very long lines of mostly optional parameters) would be great. I’m also sure that there must be some way of compartmentalizing in places, so that the one massive class could be split into several files and classes that are only loaded if needed - maybe if I had a spare year I could go for it! :P

Anyway, there is my experience on the thing - I hope it’s useful to someone.

Hi … I am currently working on a project and need a print feature but I can not find extensions that able print the data model (all pages). Current extensions are now only can print the displayed page only. How can I do that?