How do I install mpdf 7 without composer?

LuBre picture LuBre · May 10, 2018 · Viewed 23.2k times · Source

I'm currently using mpdf 6.1 and I'd like to switch to 7. But I can't find a way to install it without composer. Is there a full package that I can download, unzip and test on my localhost?

Answer

Mas Karebet picture Mas Karebet · May 17, 2018

well, i've spend few days to search a way, finally i found it, you can download full package mpdf in this site, after download extract files and place on your project and load 'vendor/autoload.php'. in my case i use it with codeigniter, so i make some php file on libraries folder to load it.

<?php 
if (!defined('BASEPATH')) exit('No direct script access allowed'); 

class M_pdf 
{ 
    function __construct()
    { 
        include_once APPPATH.'libraries\vendor\autoload.php'; 
    } 
    function pdf()
    { 
        $CI = & get_instance(); 
        log_message('Debug', 'mPDF class is loaded.'); 
    } 
    function load($param=[])
    { 
        return new \Mpdf\Mpdf($param); 
    } 
}

after that i use it on my controller file :

$this->load->library('M_pdf');
$mpdf = $this->m_pdf->load([
   'mode' => 'utf-8',
   'format' => 'A4'
]);

$mpdf->WriteHTML("Hello World!");
$mpdf->Output();

but i still recommend to use composer as well,