spipu / html2pdf

OFFICIAL PROJECT | HTML to PDF converter written in PHP
http://html2pdf.fr/en/default
Open Software License 3.0
1.68k stars 748 forks source link

how using html2pdf in codeigniter 3 #595

Open fuller2010 opened 4 years ago

fuller2010 commented 4 years ago

// CONTROLLER <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Main extends CI_Controller {

function __construct() {

} function print_pdf($id_pres='') {
$this->load->library('html2Pdf'); . . . } ?>

//application/libreries <?php defined('BASEPATH') OR exit('No direct script access allowed'); // Dompdf namespace use Spipu\Html2Pdf\Html2Pdf;

class htmlPdf{ public function __construct(){ require_once dirname(FILE).'/vendor/autoload.inc.php'; $htmlpdf = new htmlPdf(); $CI = & get_instance(); $CI->pdf = $htmlpdf ; } }

lampnick commented 3 years ago

You can try doctron,which supply living demo. Doctron is a Docker-powered,serverless,sample,fast,high quality document convert tool.Supply html convert to pdf(html2pdf), html convert to image(html2image like jpeg,png),which using chrome(Chromium) kernel, add watermarks to pdf, convert pdf to images etc.

mperezv commented 3 years ago
{
    "require": {
        "spipu/html2pdf": "^5.2"
    }
}

Now you can use html2pdf, you can try it by doing a controller function with the basic test code.