Welcome Guest, Not a member yet? Register   Sign In
Cannot open the generated PDF
#1

[eluser]bhakti.thakkar[/eluser]
Hello All,
I am using DOMPDF and generating the PDF's on the fly. There is one tmp directory in the application root which has 777 chmode. I get error (some junk data gets displayed) but the PDF's are getting saved in the tmp folder and they are fine.
Where is the issue??

code in to_pdf_pi.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
* Try increasing memory available, mostly for PDF generation
*/
ini_set("memory_limit","100M");
function pdf_create($html, $filename, $stream=TRUE)
{
    require_once(BASEPATH."plugins/dompdf/dompdf_config.inc.php");
    $dompdf = new DOMPDF();
    $dompdf->set_paper("a4", "portrait");
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    }
    write_file("./tmp/".$filename.".pdf", $dompdf->output());
}
?>

Controller :
Code:
function PreviewFollowupReportPDF($Signofffollowup_ID,$Patient_ID,$Signoff_ID)
        {
        
            $this->load->plugin('to_pdf');
            $this->load->helper('file');
            $data['Signofffollowup_ID'] = $Signofffollowup_ID;

            $html = $this->load->view('patients/followupreport' ,$data,TRUE);


            $filename='FL'.$Signofffollowup_ID."_".date('mYdHs');
            pdf_create($html,$filename,TRUE);

        
        }
#2

[eluser]bhakti.thakkar[/eluser]
Also one interesting thing that i noticed is that this is an issue only in IE. All other browsers are opening the PDF well. What could be the issue??
#3

[eluser]Kamarg[/eluser]
I had a similar issue when trying to open files over an ssl connection with IE. I found it was caused by http://support.microsoft.com/kb/323308. Essentially IE doesn't play well with cache headers over ssl when you try to open a file. Not sure if it's the same issue you're having but based on your post, it's the best I can come up with.
#4

[eluser]bhakti.thakkar[/eluser]
Thanks Kamarg... but it does not happen in all applications in IE. I have one more CI application and it does open the PDF well...




Theme © iAndrew 2016 - Forum software by © MyBB