Welcome Guest, Not a member yet? Register   Sign In
DomPdf plugin
#1

[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)
{
    require_once("dompdf/dompdf_config.inc.php");
    spl_autoload_register('DOMPDF_autoload');

    $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($move_to.$filename.".pdf", $dompdf->output());
    }
}


Controller.php
Code:
function index()
    {
                $view = false;
                
                 $this->load->model('product');
            
                 $view['lastInsertedProducts'] = $this->product->getLastInserted();

                 $this->load->plugin('PDF');
     // page info here, db calls, etc.
           $html = 'TRUE';
            pdf_create($html, 'firstPDF',base_url().'uploads/');
                
        $this->load->view('home/home_view',$view);
                
    }


Messages In This Thread
DomPdf plugin - by El Forum - 11-26-2010, 07:50 PM
DomPdf plugin - by El Forum - 11-26-2010, 07:58 PM
DomPdf plugin - by El Forum - 11-27-2010, 12:56 AM
DomPdf plugin - by El Forum - 11-27-2010, 07:47 AM
DomPdf plugin - by El Forum - 11-27-2010, 09:16 AM
DomPdf plugin - by El Forum - 11-27-2010, 12:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB