Welcome Guest, Not a member yet? Register   Sign In
CI4 PDF Customized
#17

I installed it as an unzip into thirdparty/TCPDFMaster and created a file MyPdf.php in libraries with the following
PHP Code:
<?php namespace App\Libraries;
use 
App\ThirdParty\TCPDFmaster\Tcpdf;
class 
MyPdf extends TCPDF {
    function 
__construct()
    {
        
parent::__construct();
    }


and then in my controller
PHP Code:
$pdf = new MyPdf();
        
$pdf->AddPage();
        
$pdf->writeHTMLCell(....
        
etc etc
        $filename
=whatever;
        
$file fullpathto $filename;
        
// save as file
        
$pdf->Output($file'F');
        
// send to browser
        
$this->response->setHeader('Content-Type''application/pdf');
        
$this->response->setHeader('Content-Disposition: inline;''filename="' $filename '"');
        
$this->response->setHeader('Content-Transfer-Encoding''binary');
        
$this->response->setHeader('Content-Length: 'filesize($file),'');
        
$this->response->setHeader('Accept-Ranges:''bytes');
        
readfile($file); 
Reply


Messages In This Thread
CI4 PDF Customized - by gra - 02-08-2020, 02:09 AM
RE: CI4 PDF Customized - by InsiteFX - 02-08-2020, 05:51 AM
RE: CI4 PDF Customized - by gra - 02-08-2020, 07:01 AM
RE: CI4 PDF Customized - by gra - 02-08-2020, 11:59 PM
RE: CI4 PDF Customized - by InsiteFX - 02-10-2020, 09:29 AM
RE: CI4 PDF Customized - by Hiram Rincon - 04-30-2020, 04:03 PM
RE: CI4 PDF Customized - by littlej - 02-11-2020, 11:07 PM
RE: CI4 PDF Customized - by ONGENERAL_TOWER - 03-11-2020, 07:36 AM
RE: CI4 PDF Customized - by maycoldsm1234 - 04-29-2020, 10:37 AM
RE: CI4 PDF Customized - by jreklund - 04-30-2020, 04:31 PM
RE: CI4 PDF Customized - by cocl - 06-14-2020, 10:33 PM
RE: CI4 PDF Customized - by lomali - 07-15-2020, 01:09 PM
RE: CI4 PDF Customized - by badger - 07-16-2020, 12:00 AM
RE: CI4 PDF Customized - by pippuccio76 - 01-11-2022, 04:10 AM
RE: CI4 PDF Customized - by jreklund - 06-15-2020, 12:17 PM
RE: CI4 PDF Customized - by badger - 06-16-2020, 07:16 AM
RE: CI4 PDF Customized - by [email protected] - 07-05-2020, 02:12 AM
RE: CI4 PDF Customized - by badger - 07-05-2020, 12:13 PM
RE: CI4 PDF Customized - by jreklund - 07-16-2020, 01:12 AM
RE: CI4 PDF Customized - by badger - 07-16-2020, 01:24 AM
RE: CI4 PDF Customized - by lomali - 07-16-2020, 02:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB