Welcome Guest, Not a member yet? Register   Sign In
DOMPDF Problem
#1

[eluser]aruntvla[/eluser]
when using dompdf it showing the following error..........

Code:
A PHP Error was encountered

Severity: Warning

Message: Division by zero

Filename: lib/class.pdf.php

Line Number: 4664


Unable to stream pdf: headers already sent

How to solve this one...please reply??????



My View page


Code:
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
.style2 {
    font-size: 24px;
    color: #FFFFFF;
}
.style4 {
    font-size: 24px;
    font-weight: bold;
}
.style5 {font-size: 24px; font-weight: bold; color: #FFFFFF; }
</style>
</head>
<body>
<table width="595" height="842" border="1" cellpadding="0" cellspacing="0" align="center">
<tr>
        <td height="83" bgcolor="#A42A2A"><span class="style4">&nbsp;
     </span>
     <div align="center" class="style5">Logo</div></td>
  </tr>
   <tr>
    <td height="83" bgcolor="#A42A2A"><span class="style4">&nbsp;
     </span>
     <div align="center" class="style5">Coupons</div></td>
  </tr>
&lt;?php
if(isset($coupondetail))
{  
for($i=0;$i<count($coupondetail);$i++)
{
?&gt;
<tr>
<td>&nbsp;<img >photo ; ?&gt;" border="0" style="width: 108%;"/></td>
</tr>&lt;?php }} ?&gt;
</table>
&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]danmontgomery[/eluser]
[quote author="aruntvla" date="1264017160"]<img >photo ; ?&gt;[/quote]

Post code relevant to the error, the lines where you are calling the dompdf code and line 4664 of class.pdf.php
#3

[eluser]aruntvla[/eluser]
*************to_pdf_pi.php*************************

Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');
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 {
        $CI =& get_instance();
        $CI->load->helper('file');
        write_file("./invoices_temp/invoice_$filename.pdf", $dompdf->output());
    }
}
?&gt;

**************************************************************

Controller page function

Code:
function pdf()
{
     $this->load->plugin('to_pdf');
     // page info here, db calls, etc.    
     $html = $this->load->view('user_printpreview', $this->data, true);
     pdf_create($html, 'coupon');
}

*********************************************************************

View Page

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;style type="text/css"&gt;
&lt;!--
.style2 {
    font-size: 24px;
    color: #FFFFFF;
}
.style4 {
    font-size: 24px;
    font-weight: bold;
}
.style5 {font-size: 24px; font-weight: bold; color: #FFFFFF; }
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
<table width="595" height="842" border="1" cellpadding="0" cellspacing="0" align="center">
<tr>
        <td height="83" bgcolor="#A42A2A"><span class="style4">&nbsp;
     </span>
     <div align="center" class="style5">Logo</div></td>
  </tr>
   <tr>
    <td height="83" bgcolor="#A42A2A"><span class="style4">&nbsp;
     </span>
     <div align="center" class="style5">Coupons</div></td>
  </tr>
&lt;?php
if(isset($coupondetail))
{  
         for($i=0;$i<count($coupondetail);$i++)
                    { ?&gt;
  <tr>
    <td>&nbsp;<img >photo ; ?&gt;" border="0" style="width: 108%;"/></td>
  </tr>
&lt;?php }} ?&gt;
</table>
&lt;/body&gt;
&lt;/html&gt;


Error in Localhost : Broken mesages showing in pdf file

Error in server :
Code:
A PHP Error was encountered

Severity: Warning

Message: Division by zero

Filename: include/image_frame_reflower.cls.php

Line Number: 89


Code:
A PHP Error was encountered

Severity: Warning

Message: Division by zero

Filename: lib/class.pdf.php

Line Number: 4659


Please give me a suggestion??????????
#4

[eluser]John Pantoja[/eluser]
Only Tom Cruise can divide by zero! Smile

I haven't played with DOMPDF in a minute, but what I do recall, it didn't like something with certain styling information. Try pulling out all of your embedded stuff and your css, format with just regular html tags (<br />, <p>) and see if it spits out anything. Also I think you need to do a string count or something with stream (or I might be thinking of something else) and pass it along as I think it added the Content-length: header.
#5

[eluser]aruntvla[/eluser]
Thanks Noctrum & John Pantoja , atlast i found it..wre is the problem???
when uploading images i named it with vendorname.jpg,here vendorname taken from input field...my tested image contains name as

galtech enterprises.jpg [space is the error reason]

Code:
<img >photo ; ?&gt;" border="0" style="width: 108%;"/>

actual line is filtered there is image source from my server......

so it shows error in this line......thanks friends.....




Theme © iAndrew 2016 - Forum software by © MyBB