domPDF not outputing data form db to PDF - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: domPDF not outputing data form db to PDF (/showthread.php?tid=56729) Pages:
1
2
|
domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]the_unforgiven[/eluser] Hi guys, Having a slight problem I'm hoping one or two of you can help me with. When generating a PDF with domPDF it does not carry forward the $vars i have set but yet when print_r() or var_dump() is called the vars have data in them so not sure why this. Here is the code for generating the PDF Code: function pdf() View File for account/pdf Code: // Posted from <body> tag has there's a lot of inline styling which your guys arent interested in Thanks in advance! domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]the_unforgiven[/eluser] Anyone willing to help on this? domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]Otemu[/eluser] Have you tried rendering the PDF outside codeigniter?? Using the class Code: <?php domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]the_unforgiven[/eluser] I have tried that well something similar yes with just html or text in and works fine ,but the data needs to come from the database has it's a pdf invoice! domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]Otemu[/eluser] As a way to test, add the code above to your view and then load your dynamic data with in it. I would say test each dynamic data maybe one is causing conflict I have never tried dompdf but since I am at work I cant try it for myself to see if it works. <?php require_once("dompdf_config.inc.php"); $html = '<html><body>'. //load your codeigniter dynamic data here '</body></html>'; $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf"); ?> domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]the_unforgiven[/eluser] If you use CI you should know that loading like this require_once(“dompdf_config.inc.php”); doesn't work! But i have this al set up in a helper file Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]Sonny Nguyen[/eluser] [quote author="the_unforgiven" date="1358263257"]If you use CI you should know that loading like this require_once(“dompdf_config.inc.php”); doesn't work! But i have this al set up in a helper file Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); about this line require_once("dompdf/dompdf_config.inc.php"); you can make a config file in application/configs/dompdf.php for dompdf configurations and load It like as way that CI does And move dompdf class to applications/library/ too domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]the_unforgiven[/eluser] [quote author="Nguyen Minh Son" date="1358265298"][quote author="the_unforgiven" date="1358263257"]If you use CI you should know that loading like this require_once(“dompdf_config.inc.php”); doesn't work! But i have this al set up in a helper file Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); about this line require_once("dompdf/dompdf_config.inc.php"); you can make a config file in application/configs/dompdf.php for dompdf configurations and load It like as way that CI does[/quote] That's not the answer i was looking for but thanks all the same domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]Sonny Nguyen[/eluser] please check require_once("dompdf/dompdf_config.inc.php"); you sure that file, and pdf class were loaded? and turn php error_reporting to E_ALL for debug Code: function pdf() domPDF not outputing data form db to PDF - El Forum - 01-15-2013 [eluser]the_unforgiven[/eluser] Yes everything works if i just put text into the $html var it returns the pdf but not the $varibles set and i know thw $vars work has i have a view online invoice as a seperate function |