• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using DomPDF library

#1
How to integrate domPdf library in my application.
Reply

#2
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();

}


Reply

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

#4
(05-14-2018, 05: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
Reply

#5
(05-14-2018, 10:10 PM)Paradinight Wrote:
(05-14-2018, 05: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?
Reply

#6
(05-14-2018, 11:14 PM)skunkbad Wrote:
(05-14-2018, 10:10 PM)Paradinight Wrote:
(05-14-2018, 05: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
Reply

#7
(05-15-2018, 11:05 AM)Paradinight Wrote:
(05-14-2018, 11:14 PM)skunkbad Wrote:
(05-14-2018, 10:10 PM)Paradinight Wrote:
(05-14-2018, 05: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.
Reply

#8
A quick search finds a CI wrapper for you.

https://github.com/kishorkurian123/Wkhtm...odeIgniter

I havent used it.
Reply

#9
(05-15-2018, 03:43 PM)skunkbad Wrote:
(05-15-2018, 11:05 AM)Paradinight Wrote:
(05-14-2018, 11:14 PM)skunkbad Wrote:
(05-14-2018, 10:10 PM)Paradinight Wrote:
(05-14-2018, 05: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
Reply

#10
Thanks all I have findout solution
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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