I'd like to have a page be exported as PDF in codeIgniter. I managed to install the TCPDF library following the instructions from: TCPDF Integration and now my controller looks like:
class Mycontroller extends CI_Controller {
    public function __construct(){
            parent::__construct();
            $this->load->library("Pdf");
    }
    //make pdf
    public function pdf(){
        $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
        $pdf->SetCreator(PDF_CREATOR);
        // Add a page
        $pdf->AddPage();
        $html = "<h1>Test Page</h1>";
        $pdf->writeHTML($html, true, false, true, false, '');
        $pdf->Output('output.pdf', 'I');
    }
}
Then, I have a link in another page as:
<td><a href="<?php echo base_url(); ?>index.php/myController/pdf">Export As Pdf</a></td>
and when I click on it, I get a blank pdf. The contents of the page are not there.
Any help is greatly appreciated. Thank you!
 
     
    