Welcome Guest, Not a member yet? Register   Sign In
domPDF not outputing data form db to PDF
#1

[eluser]the_unforgiven[/eluser]
Hi guys,

Having a slight problem I'm hoping one or two of you can help me with.

When generating a PDF with domPDF it does not carry forward the $vars i have set but yet when print_r() or var_dump() is called the vars have data in them so not sure why this. Here is the code for generating the PDF

Code:
function pdf()
    {
       $this->load->library('parser');
       $id = $this->session->userdata('user_id');
              
       $data['orders'] = $this->invoice_model->getInvoiceID();
       $data['query'] = $this->account_model->getCurrent($id);
       $datestring = "%d/%m/%Y";
       $time = time();
       $in = mdate($datestring, $time);
       $gen = 'Invoice - '.$in;
      
       $filename  = $gen;
       $data['title']= $gen;
       $this->load->vars($data);
      
       // Create the PDF
       $html = $this->load->view('account/pdf', $data, TRUE);
       pdf_create($html, $filename, $data);
      
    }

View File for account/pdf
Code:
// Posted from <body> tag has there's a lot of inline styling which your guys arent interested in
<body class="pdf">
<div id="tpl-manage">


<div id="main">
  <div class="corners">
    
  </div>

  <div class="hidden clearfix"></div>
  
    
  
  <table id="header" class="default">
   <tr>
    <td id="logo">
     <img src="http://localhost/hb/assets/image/logo.png" alt="" />
    </td>
    <td id="address">
     The Company
                                         Address
    </td>
   </tr>  
  </table>

  <div id="separator">
   <hr />
  </div>

  <table id="info" class="default">
   <tr>
    <td id="to">
     <div class="c">
      
      <h1 class="title">Invoice</h1>
     </div>
  
     <p>
      <strong>To:</strong><br />
      &lt;?php echo $query['fullname']; ?&gt;<br />
      &lt;?php echo $query['address1']; ?&gt;<br />
      &lt;?php echo $query['address2']; ?&gt;<br />
      &lt;?php echo $query['town']; ?&gt;<br />
      &lt;?php echo $query['city']; ?&gt;<br />
      &lt;?php echo $query['postcode']; ?&gt;<br />
      &lt;?php echo $query['county']; ?&gt;<br />
     </p>
    </td>  
    <td id="ref">
     <h3>
      <strong>Invoice #:</strong> &lt;?php echo $orders['order_id']; ?&gt;<br />
      <strong>Date:</strong> &lt;?php echo $orders['order_date']; ?&gt;</h3>
    </td>
   </tr>  
  </table>


  
  <table id="body" class="default items">
   <tr class="header">
    <th class="col1">Item</th>
    <th class="col2">Description</th>
    <th class="col3" width="75">Unit Cost</th>
    <th class="col4" width="40">Quantity</th>
    <th class="col6" width="75">Cost (GBP)</th>
   </tr>
    <tbody id="items" class="itemslist">
     <tr id="invoice_items-395310" class="item handle">
      <td class="col1">

       <span>&lt;?php echo $orders['qty']; ?&gt;<br /></span>
      </td>
      <td class="col2">
       <span>&lt;?php echo $orders['item_ordered']; ?&gt;</span>
          
      </td>
      <td class="col3">
       <span>&pound;&lt;?php echo $orders['order_amount']; ?&gt;</span>
        
      </td>
      <td class="col4">
       <span>&lt;?php echo $orders['qty']; ?&gt;</span>
      </td>
      <td class="col6">
       <span>&pound;&lt;?php echo $orders['order_amount']; ?&gt;</span>
              
      </td>
     </tr>
        
    
    </tbody>
      
    <tr class="totals">
     <td colspan="5"><hr /></td>
    </tr>
    <tr class="totals">
     <td>Sub Total:</td>
     <td colspan="3">&nbsp;</td>
     <td>
      &pound;<span class="subtotal">&lt;?php echo $orders['order_amount']; ?&gt;</span>
     </td>
    </tr>
            <tr class="totals">
     <td>Total Amount (GBP):</td>
     <td colspan="3">&nbsp;</td>
     <td>
      &pound;<span class="total">&lt;?php echo $orders['order_amount']; ?&gt;</span>
     </td>
    </tr>
  
    <tr class="totals balance">
     <td><strong>Balance:</strong></td>
     <td colspan="3">&nbsp;</td>
     <td>
      <strong>&pound;<span class="balance">&lt;?php echo $orders['order_amount']; ?&gt;</span></strong>
     </td>
    </tr>
   </tbody>
  </table>

     <div id="due">
      &lt;!--<p>Payment due&nbsp;<strong>Dec 20th 2012</strong></p>--&gt;
      <p>Status:&nbsp;<strong>&lt;?php echo $orders['order_status']; ?&gt;</strong></p>
   </div>
  
  <div id="footer" class="block">
  
    
  </div>
  
   <center>
    <br class="clear" /><br /><hr />
    <p class="powered">Company Name</p>
   </center>
    
</div>

</div>
&lt;/body&gt;
&lt;/html&gt;
So has you can see all tallys up but doesn't generate in the PDF, if i view it in the browser all works fine, but not PDF, any idea's, suggestions greatly appreciated.
Thanks in advance! Smile


Messages In This Thread
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 03:50 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 07:10 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 07:30 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 07:32 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 07:59 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 08:20 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 08:54 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 08:57 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 09:09 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 09:18 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 09:43 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 09:50 AM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 02:33 PM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 02:45 PM
domPDF not outputing data form db to PDF - by El Forum - 01-15-2013, 02:58 PM
domPDF not outputing data form db to PDF - by El Forum - 01-19-2014, 11:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB