CodeIgniter Community Voice - Generating PDF files using CodeIgniter |
[eluser]Zola[/eluser]
Thanks mrtopher, i really appreciated your help. I'll definitely try that and give you feedback. I am enjoying CI big time. :lol: Cheers.
[eluser]Geoffrey[/eluser]
Just for those that are interested, FPDI now supports TCPDF so you can import PDFs as templates. TCPDF also supports utf-8 as well. Rather than include tcpdf+fpdi as a CI library or plugin, I've added them to my php include directory so I can have 1 copy used for multiple projects. I've created a tcpdf bootstrap file that includes all the necessary files for it to work and then in my controllers where I require pdf support, I just include this bootstrap file. The nice thing with TCPDF is that it is still being actively developed with new features added like more html/css support.
[eluser]troll[/eluser]
hi, i tested it and works very good. but i have some problems trying to attach some images. in the documentation there is a ezImage function. i used it with the full path of my image but it is noy displayed within the pdf document. Code: $this->cezpdf->ezImage(base_url().$this->config->item('FAL_css')."/log_4.jpg"); please help!! thanks
[eluser]giannis[/eluser]
[quote author="troll" date="1228029239"]hi, i tested it and works very good. but i have some problems trying to attach some images. in the documentation there is a ezImage function. i used it with the full path of my image but it is noy displayed within the pdf document. Code: $this->cezpdf->ezImage(base_url().$this->config->item('FAL_css')."/log_4.jpg"); please help!! thanks[/quote] There are some complaints from PHP about a variable $cont and $offset. A PHP Error was encountered Severity: Notice Message: Undefined variable: cont Filename: libraries/cezpdf.php Line Number: 1309 ----------- A PHP Error was encountered Severity: Notice Message: Undefined variable: offset Filename: libraries/cezpdf.php Line Number: 1393 what I did was to put the @ in front of them so the warning is not displayed (not the best solution but it worked for me!!) line 1309 @$cont.= fread($fp,1024); line 1389 $this->addJpegFromFile($image,$this->ez['leftMargin'] + $pad + @$offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width); line 1393 $this->addPngFromFile($image,$this->ez['leftMargin'] + $pad + @$offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width); Another thing you could do is lower the level of errors reported by php. ;-) PS: I noticed that it doesnt display pngs with 32bit depth but does display the ones with 24bit depth :S :S :S :S :S
[eluser]ldg430[/eluser]
I am using cezpdf and it is working great for generating reports from database results. In fact it's great for multi-page reports (a lot faster than DOMPDF). I have one controller, reports.php and one view, reports_view.php. In the view you can pick which report to create which then calls the appropriate function in the controller. Up till now, all the reports where in LETTER and portrait. I am creating a report that I would like to print in landscape mode. I am stumped as to how to change the paper orientation. The orientation as well as the paper size are set in the constructor of the cezpdf class. function Cezpdf($paper='LETTER',$orientation='portrait'){ // Assuming that people don't want to specify the paper size using the absolute coordinates // allow a couple of options: // orientation can be 'portrait' or 'landscape' .... I tried setting the orientation in the helper, pdf_helper.php using $CI->cezpdf('LETTER','landscape'); or in my controller function $this->cezpdf('LETTER','landscape'); In either case, I just get a blank page - no PDF. As I mentioned, I am just stumped! It's probably a simple thing that I am not seeing. Any help is appreciated.
[eluser]Thiago Luiz[/eluser]
Hi, I'm trying to open a existent pdf file into a browser, but I had no success... Some one can help me?
[eluser]geshan[/eluser]
How can I force download of the generated pdf, I tried the output function but not able to force download. How do I do ti?
[eluser]Thiago Luiz[/eluser]
Put the pdf file into a subfolder on the same level of the CI system folder. In the controller, write a function with following contents: $this->load->helper ( ‘download’); $data = file_get_contents ( “subfolder / file.pdf”); $name = ‘file.pdf’; force_download ($name, $data);
[eluser]geshan[/eluser]
which subfolder? the output function does not seem to work? please help... where is the file.pdf saved?
[eluser]Thiago Luiz[/eluser]
you should create a folder in the same directory where is the folder system. Within this folder you should save your files pdfs. |
Welcome Guest, Not a member yet? Register Sign In |