Welcome Guest, Not a member yet? Register   Sign In
tcpdf - example-file works, but ci controller doesn't
#1

[eluser]Jan_1[/eluser]
A) Installed tcpdf (after a try with fpdf and mpdf, all the same problem) like I was told on 'TCPDF-CodeIgniter Integration' on CI-Wiki.

B) Gave the right way in config/tcpdf.php:
Code:
$tcpdf['base_url'] = 'http://domain.com/system/application/3rdparty/tcpdf/';
$tcpdf['base_directory'] = APPPATH.'3rdparty/tcpdf/';

C) Made a controller:
Code:
<?php
class Do_pdf extends Controller
{
  function Do_pdf()
  {
        parent::__construct();
    }

    function index()
    {
        $this->load->library('pdf');
        error_reporting('e_all');
        // set document information
        $this->pdf->SetSubject('TCPDF Tutorial');
        $this->pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set font
        $this->pdf->SetFont('times', 'BI', 16);
        // add a page
        $this->pdf->AddPage();
        // print a line using Cell()
        $this->pdf->Cell(0, 12, 'Example 001 - €à èéìòù', 1, 1, 'C');
        //Close and output PDF document
        $this->pdf->Output('example_001.pdf', 'I');
    }
}
?>

But all I get is a white page. :o( buhuuuhuhu :o(

D) When I point the browser directly on an example.php-file it works...

E) Added
Code:
protected $cell_height_ratio = 1.25; //K_CELL_HEIGHT_RATIO;
in tcpdf.php

Could someone pleease give me a hint what to do?
#2

[eluser]Jan_1[/eluser]
no one interested? any ideas?
#3

[eluser]DJMOHNL[/eluser]
read this one: http://ellislab.com/forums/viewthread/133243/

Add ob_clean(); right before your $this->pdf->Output(...)

an example would be:

//Close and output PDF document
ob_clean();
$this->pdf->Output('example_001.pdf', 'I');




Theme © iAndrew 2016 - Forum software by © MyBB