DomPdf plugin |
[eluser]Ngulo[/eluser]
Hello guys, i was trying creating Pdf using this plugin i've found http://codeigniter.com/wiki/PDF_generati...ng_dompdf/ pdf is created but i can't move that to my preferred dir and also when i put code for creating in my controller i see pdf comes out is outputted, i would like to generate pdf without it is visible when page load on browser :/ any suggestions guys? here is my piece of code: PDF_pi.php plugin : Code: function pdf_create($html, $filename,$move_to, $stream=TRUE) Controller.php Code: function index()
[eluser]pabloheim[/eluser]
hi ! maybe its because you are loading the view : $this->load->view('home/home_view',$view); try deletind that line
[eluser]Matt S.[/eluser]
In your controller you need to set you HTML variable up like this: Code: $html = $this->load->view('home/home_view',$view, TRUE); Specifying the bool TRUE in the third parameter will prevent the view from being outputted to the browser. So your controller should look like this now: Code: function index() EDIT: After re-reading what you posted, I think your solution is this: Code: function index() By default, the function is set to stream the PDF rather than write it to the directory. To prevent that, just specify the boolean value FALSE as the last parameter in the pdf_create() function.
[eluser]Ngulo[/eluser]
thanks guys you're both right!! and i solved the creation not outputted now, but when i open my pdf files adobe reader tells me the file is empty or corrupted, in fact file is 0kb ![]() i just write inside $html = 'Hello world!'; seems it is creating pdf always empty file with this code :/ any other suggestions? really thanks
[eluser]pabloheim[/eluser]
hi , this is the configuration that im using . i generate a pdf file with data from database : the plugin : Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); the function inside the controller : sorry its in spanish, but it takes a hash and return data from a book (libro) using the libro_model. then get the html code after passing the data to the view file "codigo" finally generate the pdf file Code: function etiqueta(){ the view file : codigo.php Code: <html> hope it helps you!
[eluser]Ngulo[/eluser]
right thanks man ![]() i found out what was my problem :/ i did not used $dompdf->render(); inside plugin script :/ now everythings works!!!! really thanks anyway , it's good also to see other code samples ![]() and just last question guys.... what about $stream ? what is this? i can't understand if false or true,what's the effect ... ? thanks again |
Welcome Guest, Not a member yet? Register Sign In |