Welcome Guest, Not a member yet? Register   Sign In
Editable PDF, modified & emailed...with CI?
#3

[eluser]Rok Biderman[/eluser]
I think something like this should do the trick, if you used the dompdf helper:

Code:
public function index()
    {
        if ($this->input->post())
        {
            $postdata['name'] = $this->input->post('name'); //let's say the data we want to get from the form is a name
            $html = $this->load->view('someview', $postdata, true); //pass view as a variable
            $pdfoutput = pdf_create($html, '', false);
            $tempname = 'yourtempname.pdf'; //the name is best kept dynamic (insert usernam, unixdate and such), so two simultaneus users don't overwrite each others' files'
            write_file($tempname, $pdfoutput);
            $this->email->from('[email protected]', 'Your Name');
            $this->email->to('[email protected]');

            $this->email->attach($tempname);
            $this->email->subject('Email Test');
            $this->email->message('Testing the email class.');
            $this->email->send();
            unlink($tempname); //you can delete the file afterwards so they don't eat up your space'
        }
        else
        {
            $this->load->view('theform');
        }
    }

Naturally you have to create the views 'theform' and 'someview'.


Messages In This Thread
Editable PDF, modified & emailed...with CI? - by El Forum - 08-08-2011, 10:13 AM
Editable PDF, modified & emailed...with CI? - by El Forum - 08-08-2011, 01:52 PM
Editable PDF, modified & emailed...with CI? - by El Forum - 08-08-2011, 04:03 PM
Editable PDF, modified & emailed...with CI? - by El Forum - 08-08-2011, 06:22 PM
Editable PDF, modified & emailed...with CI? - by El Forum - 08-08-2011, 11:45 PM
Editable PDF, modified & emailed...with CI? - by El Forum - 08-12-2011, 11:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB