CodeIgniter Forums
CI4 PDF Customized - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34)
+--- Thread: CI4 PDF Customized (/showthread.php?tid=75463)

Pages: 1 2 3


CI4 PDF Customized - gra - 02-08-2020

Goodmorning everyone,
i am using codeigniter version 4 rc3.
I should create pdfs but I have to customize them, this is to say that they are not like the web page displayed.
Which library do you recommend to use.
I with codeigniter 3 used fpdf.
Which is very customizable.
Since I'm doing a new project I ask, which pdf library integrates with codeigniter 4 and allows me to customize the reports I had to build by taking data from the database.
Thank you


RE: CI4 PDF Customized - InsiteFX - 02-08-2020

One of the best is TCPDF you may want to try that one there is a new version in the works.


RE: CI4 PDF Customized - gra - 02-08-2020

(02-08-2020, 05:51 AM)InsiteFX Wrote: One of the best is TCPDF you may want to try that one there is a new version in the works.

I built this library,

in App \\ Libraries \\Pdf.php

PHP Code:
<?php 

require_once dirname(__FILE__) . '/TCPDF-master/tcpdf.php';

class 
Pdf extends TCPDF
{
    function __construct()
    {
        parent::__construct();
    }
}

/* End of file Pdf.php */
/* Location: ./app/libraries/Pdf.php */ 

in Home_1 controller i call this.

PHP Code:
<?php namespace App\Controllers;

use 
App\Libraries\Pdf;

class 
Home_1 extends BaseController
{
    
    
function __construct(){       
    
}
        
    
public function index()
    {
            $pdf = new Pdf(); 

but it gives me a mistake
Class 'App\Libraries\Pdf' not found

thanks


RE: CI4 PDF Customized - gra - 02-08-2020

(02-08-2020, 07:01 AM)gra Wrote:
(02-08-2020, 05:51 AM)InsiteFX Wrote: One of the best is TCPDF you may want to try that one there is a new version in the works.

I built this library,

in App \\ Libraries \\Pdf.php

PHP Code:
<?php 

require_once dirname(__FILE__) . '/TCPDF-master/tcpdf.php';

class 
Pdf extends TCPDF
{
    function __construct()
    {
        parent::__construct();
    }
}

/* End of file Pdf.php */
/* Location: ./app/libraries/Pdf.php */ 

in Home_1 controller i call this.

PHP Code:
<?php namespace App\Controllers;

use 
App\Libraries\Pdf;

class 
Home_1 extends BaseController
{
    
    
function __construct(){       
    
}
        
    
public function index()
    {
            $pdf = new Pdf(); 

but it gives me a mistake
Class 'App\Libraries\Pdf' not found

thanks
solved it was a concept related to php7:

PHP Code:
<?php 
namespace App\ThirdParty;

use 
TCPDF



RE: CI4 PDF Customized - InsiteFX - 02-10-2020

Glad you got it to work, enjoy now.


RE: CI4 PDF Customized - littlej - 02-11-2020

Hello gra !

By the way, FDPF is still working with CI4 ;-)


RE: CI4 PDF Customized - ONGENERAL_TOWER - 03-11-2020

Can you share with me/us the complete solution?, please please Smile


RE: CI4 PDF Customized - maycoldsm1234 - 04-29-2020

[Image: 80623179-7036bf00-8a0f-11ea-841c-fa149aca5e26.png]

I have this error when trying to create a pdf, could you help me or is it the same as me


RE: CI4 PDF Customized - Hiram Rincon - 04-30-2020

(02-10-2020, 09:29 AM)InsiteFX Wrote: Glad you got it to work, enjoy now.

Can you share with me/us the complete solution?, please please, Thanks!


RE: CI4 PDF Customized - jreklund - 04-30-2020

This should do the trick.

Code:
composer require tecnickcom/tcpdf

Code:
composer install

PHP Code:
<?php namespace App\Controllers;

use 
TCPDF;

class 
Home extends BaseController
{
    public function 
index()
    {
         
$pdf = new TCPDF(PDF_PAGE_ORIENTATIONPDF_UNITPDF_PAGE_FORMATtrue'UTF-8'false);
    }