Yii Framework Forum: Yii with generating and printing reports, charts etc. - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Yii with generating and printing reports, charts etc. experience with generating and printing data with Yii Rate Topic: ***** 3 Votes

#21 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 22 May 2011 - 03:30 AM

View Postitmagetan, on 21 May 2011 - 07:28 AM, said:

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?


I don't fully understand your question - what exactly are you trying to print and how?
Are you actually trying to print something, or just let a user print a web page?
If you want your user to print a web page, then he will only be able to print what is shown on that page (possibly in a different style if you do another CSS file).
If you want to provide your user with a printable report, then you can either make an Html view that corresponds to that report, and the user will have to work out how he wants to print the web page himself, or you have the option of doing what I did, which is to have a controller action that generates and sends a Pdf file to the browser, so that the user can print that.

Whatever the case, you will be responsible for gathering the data you want (perhaps in a DataProvider) and setting out the view as you want it.
Rupert
0

#22 User is offline   mecano 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 18-June 11
  • Location:Colombia

Posted 16 April 2012 - 06:00 PM

Hi i try to use your file whit the last tcpdf file but i only get in screen...

TCPDF ERROR: Could not include font definition file: pdf_font_name_main

i check everting and i lost...

you can help me ..
thanks...



View PostRedRabbit, on 11 May 2011 - 10:00 AM, said:

Ok, I've finished my project involving generating Pdf reports, so as promised, here is what I used - Attachment RRTCPdf.zip.

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.

0

#23 User is offline   nakovn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 18-July 12

Posted 31 July 2012 - 01:58 AM

Can I use Google API to draw charts instead of extensions.
Any idea?
0

#24 User is offline   beks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 26-October 13

Posted 11 November 2013 - 06:49 AM

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? Some help.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users