Welcome Guest, Not a member yet? Register   Sign In
*HELP* Intergrate TCPDF
#6

[eluser]Jonathan Gordon[/eluser]
For one thing, if you look in the fonts folder, you'll see arial.(php/ctg.z/z) does not exist. Try using a font that comes with the library.

Basically, to get it to work, you need to set up the tcpdf.php to point to the correct folder, if you choose to have all the components in a sub-folder like I do, and I'm assuming anyone else avoiding a headache would do.

I defined my fonts path in the config file, and I found that using the normal $pdf class straight up breaks. I haven't messed with it enough to see what will unbreak it, and I'm no codeigniter pro here.

Anyway, here's what I used, and it worked fine. I'll be using tcpdf to output lots and lots of user reports from a web app I'm making now, I'll update this with anything I find in the next few days of swearing and experimenting.

Code:
<?php

class Pdf extends Controller {
    
    function Pdf()
    {
        parent::Controller();
    }
    
    function index()
    {
        $this->load->library('tcpdf');
        $this->tcpdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $this->tcpdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $this->tcpdf->Open();
        $this->tcpdf->AddPage();
        $this->tcpdf->SetFont('Freeserif','B',14);
        $this->tcpdf->SetY(30);
        $this->tcpdf->Cell(40,10,'Hello World!<br>test');
        $this->tcpdf->Output('output.pdf','I');
    }
}

?&gt;


Oooooh, okay, so I peeked around in the library for a couple seconds, and it seems as though anything you need to be doing with $pdf (which as far as I remember, is the fdpf class), you can access with the aliased version through tcdpf. So for those lines I dropped out, do this:

Code:
$this->tcpdf->SetFont("vera", "BI", 20);
        $this->tcpdf->Cell(0,10,'TEST Bold-Italic Cell',1,0,'C');

Now to make it pretty. Smile


Messages In This Thread
*HELP* Intergrate TCPDF - by El Forum - 07-17-2007, 03:09 PM
*HELP* Intergrate TCPDF - by El Forum - 07-17-2007, 05:27 PM
*HELP* Intergrate TCPDF - by El Forum - 07-17-2007, 10:58 PM
*HELP* Intergrate TCPDF - by El Forum - 09-04-2007, 06:15 AM
*HELP* Intergrate TCPDF - by El Forum - 09-04-2007, 06:24 AM
*HELP* Intergrate TCPDF - by El Forum - 10-01-2007, 01:43 AM
*HELP* Intergrate TCPDF - by El Forum - 04-08-2008, 07:56 AM
*HELP* Intergrate TCPDF - by El Forum - 05-23-2008, 02:25 PM
*HELP* Intergrate TCPDF - by El Forum - 09-15-2008, 08:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB