Welcome Guest, Not a member yet? Register   Sign In
White screen creating PDF
#1

[eluser]rijobo[/eluser]
Hello,

I'm using DOmpdf for creating pdf's. the problem is that when I try to do this, I only see a white screen and nothing is saved on the server.
Does someone know what I do wrong?

My controller function:
Code:
function generatePDF() {
        
     $this->load->plugin('pdf_plugin');
     $data['navlist'] = $this-> mmateriaal-> getMateriaalNav();
     // page info here, db calls, etc.    
     $html = $this->load->view('pdf_view', $data, true);
     pdf_create($html, 'filename');
}

My view:
Code:
<!DOCTYPE html>
&lt;html&gt;
    &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt;AEC Ding&lt;/title&gt;
    &lt;/head&gt;

    &lt;body&gt;
        <h3>Dit zijn de gebruikers die nu in de database staan:</h3>
            Hallooooooooooooooo!
    &lt;/body&gt;
&lt;/html&gt;

My plugin:
Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');
ini_set("display_errors","on");
error_reporting(E_ALL);
function pdf_create($html, $filename, $stream=FALSE)
{
    require_once("dompdf/dompdf_config.inc.php");
    
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    } else {
        $CI =& get_instance();
        $CI->load->helper('file');
        write_file('".base_url()."/invoices_temp/invoice_$filename.pdf', $dompdf->output());
    }
}
?&gt;
#2

[eluser]suba[/eluser]
Hi all,

I also got same problem.

If any one knows answer, please let reply to this.

Thanks for your help.
#3

[eluser]suba[/eluser]
Hi all,

please advise , what can i need to do changes?

I also got white screen page.

Thanks.
MY controller.
Code:
ob_start();
class Graduation extends Controller
{
    function Graduation()
    {
        parent::Controller();
        $this->data=$this->model_sims->getPage();
        $this->load->library(array('ajax','form_validation'));
        $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
    }
function certificate()
{
    $this->model_sims->checkAuthorization();
    if($this->uri->segment(3))
    {
        
     $this->load->plugin('to_pdf');
     // page info here, db calls, etc.    
     $html = $this->load->view('graduate_view', $this->data,true);
     pdf_create($html, 'filename');
       }
}
}// controller
My view.
--------
Code:
&lt;html&gt;
&lt;body&gt;
<h2>WELCOME</h2>
&lt;/body&gt;
&lt;/html&gt;
#4

[eluser]suba[/eluser]
[quote author="rijobo" date="1262751494"]Hello,

I'm using DOmpdf for creating pdf's. the problem is that when I try to do this, I only see a white screen and nothing is saved on the server.
Does someone know what I do wrong?

My controller function:
Code:
function generatePDF() {
        
     $this->load->plugin('pdf_plugin');
     $data['navlist'] = $this-> mmateriaal-> getMateriaalNav();
     // page info here, db calls, etc.    
     $html = $this->load->view('pdf_view', $data, true);
     pdf_create($html, 'filename');
}

My view:
Code:
<!DOCTYPE html>
&lt;html&gt;
    &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt;AEC Ding&lt;/title&gt;
    &lt;/head&gt;

    &lt;body&gt;
        <h3>Dit zijn de gebruikers die nu in de database staan:</h3>
            Hallooooooooooooooo!
    &lt;/body&gt;
&lt;/html&gt;

My plugin:
Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');
ini_set("display_errors","on");
error_reporting(E_ALL);
function pdf_create($html, $filename, $stream=FALSE)
{
    require_once("dompdf/dompdf_config.inc.php");
    
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    } else {
        $CI =& get_instance();
        $CI->load->helper('file');
        write_file('".base_url()."/invoices_temp/invoice_$filename.pdf', $dompdf->output());
    }
}
?&gt;
[/quote]
Quote:SOLVED
#5

[eluser]suba[/eluser]
Hi, rijobo

Open dompdf_config.inc.php

and change
Code:
define("DOMPDF_PDF_BACKEND", "auto");

to

define("DOMPDF_PDF_BACKEND", "CPDF");




Theme © iAndrew 2016 - Forum software by © MyBB