CodeIgniter Forums
Using DomPDF library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7)
+--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13)
+--- Thread: Using DomPDF library (/showthread.php?tid=70679)

Pages: 1 2


Using DomPDF library - sharad23nov - 05-14-2018

How to integrate domPdf library in my application.


RE: Using DomPDF library - qury - 05-14-2018

Just read the documentation on https://github.com/dompdf/dompdf

Say you do not have composer auto-loading configured:
- download the library and extract under applications/third_party
- in your controller or model load it like this:
PHP Code:
<?php
 
require_once APPPATH.'third_party'
 
                  .DIRECTORY_SEPARATOR.'dompdf'
 
                  .DIRECTORY_SEPARATOR.'autoload.inc.php';

use 
Dompdf\Dompdf;

class 
Yourclass extends CI_Controller{

public function 
index (){
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4''landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF to Browser
$dompdf->stream();

}





RE: Using DomPDF library - skunkbad - 05-14-2018

I think you will find that DOMPDF sucks. Search the internet for wkhtmltopdf. Much better PDF generation.


RE: Using DomPDF library - Paradinight - 05-14-2018

(05-14-2018, 04:16 PM)skunkbad Wrote: I think you will find that DOMPDF sucks. Search the internet for wkhtmltopdf. Much better PDF generation.

or
https://github.com/GoogleChrome/puppeteer
https://github.com/spatie/browsershot


RE: Using DomPDF library - skunkbad - 05-14-2018

(05-14-2018, 09:10 PM)Paradinight Wrote:
(05-14-2018, 04:16 PM)skunkbad Wrote: I think you will find that DOMPDF sucks. Search the internet for wkhtmltopdf. Much better PDF generation.

or
https://github.com/GoogleChrome/puppeteer
https://github.com/spatie/browsershot

Both require Node, which is fine if you have Node in production, but many basic shared hosting accounts don’t have it. Am I missing something?


RE: Using DomPDF library - Paradinight - 05-15-2018

(05-14-2018, 10:14 PM)skunkbad Wrote:
(05-14-2018, 09:10 PM)Paradinight Wrote:
(05-14-2018, 04:16 PM)skunkbad Wrote: I think you will find that DOMPDF sucks. Search the internet for wkhtmltopdf. Much better PDF generation.

or
https://github.com/GoogleChrome/puppeteer
https://github.com/spatie/browsershot

Both require Node, which is fine if you have Node in production, but many basic shared hosting accounts don’t have it. Am I missing something?

browsershot use puppeteer.

yes you need nodejs Sad


RE: Using DomPDF library - skunkbad - 05-15-2018

(05-15-2018, 10:05 AM)Paradinight Wrote:
(05-14-2018, 10:14 PM)skunkbad Wrote:
(05-14-2018, 09:10 PM)Paradinight Wrote:
(05-14-2018, 04:16 PM)skunkbad Wrote: I think you will find that DOMPDF sucks. Search the internet for wkhtmltopdf. Much better PDF generation.

or
https://github.com/GoogleChrome/puppeteer
https://github.com/spatie/browsershot

Both require Node, which is fine if you have Node in production, but many basic shared hosting accounts don’t have it. Am I missing something?

browsershot use puppeteer.

yes you need nodejs  Sad

Well, I don't know if you've tried wkhtmltopdf, but it's almost perfect. Yes, you've still got some custom CSS needed for tables that spam multiple pages, but I think you'll find it's great compared to DOMPDF. With DOMPDF you can't even have floated divs for columns.


RE: Using DomPDF library - zurtri - 05-15-2018

A quick search finds a CI wrapper for you.

https://github.com/kishorkurian123/Wkhtmltopdf-PHP-CodeIgniter

I havent used it.


RE: Using DomPDF library - Paradinight - 05-15-2018

(05-15-2018, 02:43 PM)skunkbad Wrote:
(05-15-2018, 10:05 AM)Paradinight Wrote:
(05-14-2018, 10:14 PM)skunkbad Wrote:
(05-14-2018, 09:10 PM)Paradinight Wrote:
(05-14-2018, 04:16 PM)skunkbad Wrote: I think you will find that DOMPDF sucks. Search the internet for wkhtmltopdf. Much better PDF generation.

or
https://github.com/GoogleChrome/puppeteer
https://github.com/spatie/browsershot

Both require Node, which is fine if you have Node in production, but many basic shared hosting accounts don’t have it. Am I missing something?

browsershot use puppeteer.

yes you need nodejs  Sad

Well, I don't know if you've tried wkhtmltopdf, but it's almost perfect. Yes, you've still got some custom CSS needed for tables that spam multiple pages, but I think you'll find it's great compared to DOMPDF. With DOMPDF you can't even have floated divs for columns.

i know.Big Grin


RE: Using DomPDF library - sharad23nov - 06-04-2018

Thanks all I have findout solution