Welcome Guest, Not a member yet? Register   Sign In
Problems generating PDF using domPdf
#1

[eluser]exodus7[/eluser]
Hey guys, I've been having some trouble generating a pdf file using dompdf. After following the steps in the wiki to setup domPDF and generate a pdf, i'm getting an error: "Fatal error: Class 'DOMPDF' not found in /html/system/plugins/to_pdf_pi.php on line 6". I've done everything I know from checking the file paths and permissions, but I'm suck in a rut....



Here is what the to_pdf_pi.php file looks like:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $filename, $stream=TRUE)
{
    require_once("system/plugins/dompdf/dompdf_config.inc.php");
    
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    } else {
        write_file("html/www/pdf_temp/employment_$filename.pdf", $dompdf->output());
    }
}
?>

Here's my Controller:
Code:
function generate_jobs()
        {
            $data['css'] = $this->css;
            $data['base'] = $this->base;
            $data['pgtitle'] = 'Generate PDF';
                            
                                $this->db->where('active','y');
                                $this->db->order_by('post_date','desc');
            $data['query'] =     $this->db->get('employment');
            $this->load->helper('file');
            $this->load->plugin('to_pdf');    
            
                    
                 $html = $this->load->view('ccJobPostingGenerator', $data, true);
                 pdf_create($html, 'filename');
            
        }

Here's the view file:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Job Postings&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<h1>Current Job Postings</h1>
<hr />
&lt;?php foreach ($query as $row): ?&gt;
<table width="800" border="0">
  <tr>
    <td width="300">Job Title</td>
    <td>&lt;?=$row->job_title;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Job Number    </td>
    <td>&lt;?=$row->job_num;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Posting Date</td>
    <td>&lt;?=$row->post_date;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Department</td>
    <td>&lt;?=$row->department;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Basic Fuctions</td>
    <td>&lt;?=$row->basic_functions;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Salary</td>
    <td>&lt;?=$row->salary;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Hours</td>
    <td>&lt;?=$row->hours;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Resume Deadline</td>
    <td>&lt;?=$row->resume_deadline;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Location</td>
    <td>&lt;?=$row->location;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Preferred Requirements</td>
    <td>&lt;?=$row->require_prefer;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Minimum Requirements</td>
    <td>&lt;?=$row->require_minimum;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Contact Name</td>
    <td>&lt;?=$row->c_nam;?&gt;e</td>
  </tr>
  <tr>
    <td width="300">Contact Address</td>
    <td>&lt;?=$row->c_address;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Contact Phone</td>
    <td>&lt;?=$row->c_phone;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Contact Fax</td>
    <td>&lt;?=$row->c_fax;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Contact Email</td>
    <td>&lt;?=$row->c_email;?&gt;</td>
  </tr>
  <tr>
    <td width="300">Active</td>
    <td>&lt;?=$row->active;?&gt;</td>
  </tr>
</table>
<br />
<hr />
<br />
&lt;?php endforeach;?&gt;
&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]EBDaniel[/eluser]
try in
"to_pdf_pi.php"

with

" require_once("dompdf/dompdf_config.inc.php"); "
#3

[eluser]EBDaniel[/eluser]
without " course




Theme © iAndrew 2016 - Forum software by © MyBB