how to send dynamic PDF with mail() those generate by DOMPDF library in CI?

Related searches

Actually, generate the dynamic PDF successfully with the help of dompdf library in CI but not send the pdf dynamic those generated here. So tell me how to do this?

  $filename = "newpdffile";
    require_once APPPATH.'dompdf/autoload.inc.php';
    use Dompdf\Dompdf;
    $dompdf = new Dompdf();


    $dompdf->loadHtml($output);
    $dompdf->setPaper('A4', 'landscape');
    $dompdf->render();
    $dompdf->stream($filename);

    $file_to_save="/application/dompdf/";
    $pdf=file_put_contents($file_to_save, $dompdf->output());

     $this->email->from('support@aurorax.co', 'aurora exchange');
        $this->email->to('masnad@aurorax.co');
        $this->email->subject('pdf');
        $this->email->attach($pdf);
        $this->email->message('Hello!');

If you have sucesssfully generated PDF and saved in dompfdf directory then

$pdf= 'http://yourwebsite.com/dompfdf/<?php echo $pdfNameYouGenerated; ?>';
$this->email->attach($pdf);

Create Dynamic PDF & Send as Attachment with Email in PHP , If you are trying to create dynamic pdf file from mysql database and then after you want to send that dynamically generated pdf file as attachment with email, this is a PHP, MySql, Jquery, AngularJS, Ajax, Codeigniter, Laravel Tutorial dompdf library which is the best library for create PDF file from HTML. In this tutorial, i am going to share with you how to create pdf file from html view using dompdf library in Codeigniter 3 application. We will integrate dompdf library from scratch so no issue if you don't know about dompdf library. We generally require to generate PDF for invoice, data, information, subscription etc.

Use APPPATH to get the file path

$file_to_save = APPPATH. "application/dompdf/";
$pdf = file_put_contents($file_to_save, $dompdf->output());

When PDF file successfully generated and save in the directory then attach while sending email

$this->email->from('support@aurorax.co', 'aurora exchange');
$this->email->to('masnad@aurorax.co');
$this->email->subject('pdf');
$this->email->attach($pdf);
$this->email->message('Hello!');

How to Generate Dynamic PDF using Dompdf in Codeigniter , How to make Codeigniter Library for generate PDF document from HTML. How to your Duration: 22:27 Posted: Apr 28, 2018 So, in this post we have conver this topic in which we have learn how can we create dynamic pdf file from mysql database by using domPDF library and then after we will send that dynamically created pdf file will send as attachment with email using PHPMailer in PHP script. So, here we have learn PHP send email with PDF attachment.

Please check below code:

$filename = "newpdffile";
    require_once APPPATH.'dompdf/autoload.inc.php';
    use Dompdf\Dompdf;
    $dompdf = new Dompdf();


    $dompdf->loadHtml($output);
    $dompdf->setPaper('A4', 'landscape');
    $dompdf->render();


    $output = $dompdf->output();
    $filePath = FCPATH.'application/dompdf/filename.pdf';
    file_put_contents($filePath, $output);

    $this->email->from('support@aurorax.co', 'aurora exchange');
        $this->email->to('masnad@aurorax.co');
        $this->email->subject('pdf');
        $this->email->attach($filePath);
        $this->email->message('Hello!');

Create a PDF and Send by Email in PHP, Learn How to generate PDF and send as attachment in PHP. Create PDF file using DomPDF Duration: 20:57 Posted: Aug 12, 2018 Here in this post, we are going to see how to generate the PDF from an HTML template. In brief, Dompdf is the HTML to PDF converter that is written in PHP and can be used by developers to generate PDF. This is mostly a CSS 2.1 compliant HTML layout and rendering engine. A few CSS3 properties also can be handled by Dompdf.

Generate PDF from View using DomPDF in CodeIgniter 3, How to Generate PDF from CodeIgniter View? STEP-1) First download dompdf library, then extract and move the folder to codeigniter's 'application/library' folder. STEP-2) Next create a custom code igniter library to create pdf using the dompdf class. STEP-3) Then you need the codeigniter view file. Learn How to convert HTML to PDF by using Dompdf Library in Codeigniter. How to make Codeigniter Library for generate PDF document from HTML. How to create d

Codeigniter 3, In this tutorial, i am going to share with you how to create pdf file from html view using dompdf library in Codeigniter 3 application. We will� Think about order documents in your eCommerce application, coupons for your marketing campaign or just the PDF version from your web page. There are plenty of situations were a dynamic PDF document is a great way to solve problems, too. Using PHP it’s possible generate those PDF files.

Learn How to generate PDF and send as attachment in PHP. Create PDF file using DomPDF and send PDF file as attachment with Email using PHPMailer. Convert HTM

Comments
  • Do you want send PDF file in email?
  • yes i want to send pdf
  • pls anyone help me
  • file is not save firstly
  • @PRATIKSHAGOYAL so you are not able to generate PDF, right?
  • i generate the PDF succesfully but i not able to save pdf in particular folder
  • what to do? pls suggest me
  • But according to your question file is saving in folder dompdf inside the application folder
  • i tired to save the PDF file after generate that time show the Failed to load PDF document... so what to do ???
  • file is not saving in folder dompdf inside the application folder @danish ali
  • Refer to this link github.com/dompdf/dompdf/wiki/Using-Dompdf-in-CodeIgniter-3.x
  • It's FCPATH not FC_PATH
  • its code is not work here.. error show Failed to load PDF document.