1

I want to ask how can I convert excel to pdf?

I want to put 5 excel files and after I click upload in convert to 1 pdf?

for now I use in this code:

    /**
 * Example: DOMPDF 
 *
 * Documentation: 
 * http://code.google.com/p/dompdf/wiki/Usage
 *
 */
public function index() {   
    // Load all views as normal
    $this->load->view('test');
    // Get output html
    $html = $this->output->get_output();

    // Load library
    $this->load->library('dompdf_gen');

    // Convert to PDF
    $this->dompdf->load_html($html);
    $this->dompdf->render();
    $this->dompdf->stream("welcome.pdf");

}

the library:

class Dompdf_gen {

public function __construct() {

    require_once APPPATH.'third_party/dompdf/dompdf_config.inc.php';

    $pdf = new DOMPDF();

    $CI =& get_instance();
    $CI->dompdf = $pdf;

}

}

Burpy Burp
  • 459
  • 3
  • 12
idan003
  • 15
  • 2
  • 7
  • 1
    Possible duplicate, this answer might help you http://stackoverflow.com/questions/23223491/how-to-convert-xls-to-pdf-via-php – run.cycle.daft Oct 08 '14 at 16:12
  • i see the post But I do not understand about me code i i upload file excel and after i do open file and take the data from the excel and put in the pdf Is this possible? – idan003 Oct 09 '14 at 07:23

2 Answers2

0

first of things , you have to dump all excel to php array or var , after that you can create pdf as you want , this is simple php script for convert excel to pdf , you can use it and convert it to subclass of codeigniter as well

please check this url

PHP read excel file

when you use that class your excel data will be with you so you can use another class for pdf and this class will help you

codeigniter create PDF file

hopeful this is helpful for you .

Mr.Geeker
  • 395
  • 3
  • 13
  • I do not understand the problem. like in this code: $this->load->helper(array('dompdf', 'file')); // page info here, db calls, etc. $html = $this->load->view('home', $data, true); pdf_create($html, 'filename') or $data = pdf_create($html, '', false); write_file('name', $data); how i put after i upload excel file and cover it to pdf? this function is only for HTML – idan003 Oct 10 '14 at 16:31
  • Hello , First of thing , convert your data from excel to php array or any data storage variable or array or class whatever , then use pdf class to create a pdf file , pass that data you got from excel to pdf class – Mr.Geeker Mar 03 '16 at 21:24
0

I do not understand the problem. like in this code:

    $this->load->helper(array('dompdf', 'file'));
    // page info here, db calls, etc.
    $html = $this->load->view('home', $data, true);
    pdf_create($html, 'filename')
    or
    $data = pdf_create($html, '', false);
    write_file('name', $data);

how i put after i upload excel file and cover it to pdf? this function is only for HTML

idan003
  • 15
  • 2
  • 7