• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4 PDF Customized

#1
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
Reply

#2
One of the best is TCPDF you may want to try that one there is a new version in the works.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(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
Reply

#4
(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
Reply

#5
Glad you got it to work, enjoy now.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#6
Hello gra !

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

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

#8
[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
Reply

#9
(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!
Reply

#10
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);
    }

Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.