CI4 Dynamic DOMPDF view , |
Hey All ,
I am getting a blank page/error when I try to load the dynamic data on the dompdf. If i write any PHP code inside it is showing an error . Please refer the code i written , #viewpage data $html = view($this->path_views . 'contract', $data); $this->dompdf->loadHtml($html); $this->dompdf->setPaper('A4','portrait'); $this->dompdf->set_option('defaultMediaType', 'all'); $this->dompdf->set_option('isFontSubsettingEnabled', true); $this->dompdf->set_option('isPhpEnabled', true); $this->dompdf->render(); $this->dompdf->stream( $html, array("Attachment" => false)); Please help me to resolve this issue , how i can show dynamic pdf view in CI4 using dompdf. I really appreciate any help you can provide.
This is an example of code that works for me:
Code: $dompdf = new \Dompdf\Dompdf();
Hi,
Thanks for your message , The static page is loaded for me, When I pass "$data" it is returning an error or the blank page. The issue am facing is dynamic values loading on the view page. I really appreciate any help you can provide Thank you,
Try something simple like:
Code: $data['testMessage'] = 'Testing domPDF with PHP code'; And a simple view: Code: <!doctype html> Does your view load correctly on screen?
Hello and sorry for activating this old thread again... but I am running in a problem with CI 4.4.3 and Dompdf. I've created a view as proposed here, it works fine when I view it. But as soon as I send the view to DomPDF I get an (seemingly) empty pdf in browser. When I download it and open it with a text editor it contains the CI debug page with the error
Code: ini_set(): Session ini settings cannot be changed after headers have already been sent I've installed shield, tried to remove it from loaded filters already, but nothing helped yet. Does anyone has an idea what's wrong?
The error message tells you what's wrong. You have already sent a header before the ini_set() is called.
@trunky This has nothing to do with Shield.
The code below should work fine. PHP Code: But on the condition that you set mode CI_ENVIRONMENT = production. Otherwise, you will receive a white file (Error Failed to load PDF document.). @kenjis Dompdf is one of the popular and widely used libraries. Please check if you can why there is a problem in mode development.
@datamweb I cannot reproduce any error with "CI_ENVIRONMENT = development"
Code: $ composer require dompdf/dompdf PHP Code: <?php
@kenjis, can you upload the file(ci443.pdf) generated by the above code in mode development here?
|
Welcome Guest, Not a member yet? Register Sign In |