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

[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()
    {
                $view = false;
                
                 $this->load->model('product');
            
                 $view['lastInsertedProducts'] = $this->product->getLastInserted();

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


EDIT: After re-reading what you posted, I think your solution is this:

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/', FALSE); // Insert FALSE as the last parameter to prevent streaming
                
        $this->load->view('home/home_view',$view);
                
    }

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.


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