5Fermer7
ffentonLe 26/04/2009 à 18:46
I'm having a similar problem which only occurs in Internet Explorer (6 & 7), everything works fine in Firefox. Internet Explorer 6 and 7 will only create pdf up to 2 pages. On a four page pdf Firefox will output fine, IE 7 gives a 'Cannot find server' error and IE 6 doesn't even attempt to load it. If Firefox isn't having any problems then I wouldn't have thought memory_limit is the cause?? Current memory_limit in php.ini is 16M

Here is my code:

	
	 //get posted values
  $refno = $_GET['refno'];
  $instructno = $_GET['instructno'];
  $date = $_GET['date'];
  $address = $_GET['address'];
	if($instructno){
	  $documentname = $instructno.'.pdf';
	}else{
	  $documentname = 'photosheet.pdf';
	}
 	ob_start();
	
 	include('photosheet.php');
	$content = ob_get_clean();
  
	// conversion HTML => PDF
	require_once('html2pdf.class.php');
	$html2pdf = new HTML2PDF('P','A4', 'en');
	$html2pdf->WriteHTML($content);
	$html2pdf->Output($documentname); 


and code for photosheet.php is:

page backtop="15mm" backbottom="10mm">
	<page_header>
		<table style="width: 90%; border:none;"  align="center">
			<tr>	
			  <td style="width:20%;"></td>			
				<td  style="text-align: center; width: 60%; font-size: 24px; border: solid 1px black;" >Company name</td>		
				<td style="width:20%;"></td>		
			</tr>
			<tr>
			  <td style="text-align: left;">Reference No: <?php echo $refno; ?></td>
				<td style="text-align: center;">Instruction No: <?php echo $instructno; ?></td>
				<td style="text-align: right;">Date: <?php echo $date; ?></td>
			</tr>
		</table>
	</page_header>
	
	<page_footer>
		<table style="width: 90%; border:none"  align="center">
			<tr>
				<td style="text-align: left;	width: 10%; height:7mm;">Property</td>
				<td style="text-align: center;	width: 90%; border: solid 1px black;"><?php echo $address; ?></td>
			</tr>
		</table>
	</page_footer>
	
	<table style="width: 90%;border: solid 1px #000000; border-collapse: collapse" align="center">
<?php 

 foreach ($_REQUEST as $key=>$value) {
    if (is_array($value)) {
		   $n=0;
			 $i=0;
			 $lastkey = end(array_keys($value));
		 while($i < ($lastkey+1)){
			$img =$value[$i];
	 if	(isset($img)){
   if(!($n&1)){
?>
	  <tr>
			<td style="width: 50%; text-align: center; border: solid 1px #000000; height:62mm;">
			  <?php  
				 echo '<img src="'.$img.'" style="width:90%" />';	
				 $n=$n+1;
				echo '</td>';
  }else{   ?>
       <td style="width: 50%; text-align: center; border: solid 1px #000000; height:62mm;">
			  <?php  
				 echo '<img src="'.$img.'" style="width:90%" />';	
				 $n=$n+1;	
				echo '</td></tr>';
     }
       }else{
       //if the image isn't ticked do nothing
      } 
			$i=$i+1;  
     } //close for loop		
    }  //close if array loop 
		} //close while loop
if($n&1){ ?>
		   <td style="width: 50%; text-align: center; border: solid 1px #000000; height:62mm;">&nbsp; </td></tr>	
<?php   }
?>
	</table>
	</page> 



(I'm using v3.20 and PHP5)