[eluser]bhakti.thakkar[/eluser]
Hello all,
there is a button on my page for creating a preview. when the user clicks the button, there is a prompt to either Open or Save the document. When a user clicks Save and then open the Saved document, it works well. But if directly clicks on open, then it generates :
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined index: dompdfuniqueid</p>
<p>Filename: include/frame.cls.php</p>
<p>Line Number: 183</p>
</div>%PDF-1.3
%âãÏÓ
1 0 obj
<< /Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R
/OpenAction 8 0 R >>
endobj
2 0 obj
ETC ETC
to_pdf_pi.php
Code:
function pdf_create($html, $filename, $stream=TRUE)
{
require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
if ($stream) {
$dompdf->stream($filename.".pdf");
} else {
$output = $dompdf->output();
file_put_contents('../../tmp/pdf/'.$filename.".pdf", $output);
// write_file("./tmp/pdf/$filename.pdf", $dompdf->output());
}
}
Controller : certificate.php
Code:
function PreviewCertificatePDF($TransactionCertificate_ID , $ITCType_TI) {
$this->load->plugin('to_pdf');
$data['TransactionCertificate_ID'] = $TransactionCertificate_ID;
$query = $this->db->query("Exec up_parmsel_rpt_TempTransactionCertificate @TransactionCertificate_ID='$TransactionCertificate_ID' , @Company_ID='' ");
@TransactionCertificate_ID='$TransactionCertificate_ID' , @Company_ID='' ");
$data['pgdata'] =$query->result_array();
$pg="PreviewCertificate";
$html = $this->load->view('certificates/'.$pg ,$data,true);
$filename = 'TR'.$TransactionCertificate_ID."_".date('mYdHis');
pdf_create($html, $filename,true);
}
What have i done wrong
Thanks in advance