Welcome Guest, Not a member yet? Register   Sign In
dompdf output on screen instead of in file
#1

[eluser]rijobo[/eluser]
When I use DomPDF with this controller:

Code:
function pdf(){
        $data['title'] = "Welkom in de webwinkel van Simo-Edelsmid";
        $data['navlist'] = $this-> mmateriaal-> getMateriaalNav();
        $data['main'] = 'home';
        $data['mainf'] = $this-> mproducts-> getMainFeature2();
        $data['foto_teller'] = '1';
        $data['foto_regel'] = '3';
        $this-> load-> vars($data);
          $html = $this->load->view('test', $data, true);
         pdf_create($html, 'filename');
    }

and this plugin:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $filename, $stream=TRUE)
{
    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("./invoices_temp/invoice_$filename.pdf", $dompdf->output());
    }
}
?>

It shows the pdf on screen in html I think. It doesn't save the pdf in a file.

How can this happen?
#2

[eluser]rijobo[/eluser]
Now I've changed the stream to false and I just get a blank screen, again it doesn't create a pdf.
#3

[eluser]rijobo[/eluser]
Also tried R&OS;pdf class, but again I only see some strange things on my screen, no pdf is created. Looks like it's showing the pdf as html on my screen.
#4

[eluser]rijobo[/eluser]
Can someone please help me? I have no idea how this is possible and I'm on a deadline which is near




Theme © iAndrew 2016 - Forum software by © MyBB