Error function Barcode.php while Gero PDF with MPDF

Asked

Viewed 714 times

2

I’m on a project at the company to send the billet from here in an automatic way to the customers email. The fact is that the layout and the boleto are already working perfectly. The only problem is that, when I turn the boleto to pdf in an automatic way, it gives the following error:

"Warning: Cannot Modify header information - headers already sent by (output Started at C: wamp www siclop-enviar_boletofuncoes_itau.php:114) in C: wamp www siclop-enviar_boletopdf mpdf.php on line 8297" "Warning: Cannot Modify header information - headers already sent by (output Started at C: wamp www siclop-enviar_boletofuncoes_itau.php:114) in C: wamp www siclop-enviar_boletopdf mpdf.php on line 1706"

I’m using the mPDF and this error only happens when I call the function of generating the barcode. When I don’t call this function, it shows me the formatted pdf but obviously doesn’t show me the barcode (only the digitable line). I don’t know why he doesn’t understand the barcode. I saw that in the mPDF has a class called barcode.php; I don’t know if he accepts the barcode just using this class...

I wonder if you can help me with this error or if you have any suggestions as to how I might be doing this conversion to pdf? The barcode generation function code is this:

<?php 
function fbarcode($valor){

$fino = 1 ;
$largo = 3 ;
$altura = 50 ;

  $barcodes[0] = "00110" ;
  $barcodes[1] = "10001" ;
  $barcodes[2] = "01001" ;
  $barcodes[3] = "11000" ;
  $barcodes[4] = "00101" ;
  $barcodes[5] = "10100" ;
  $barcodes[6] = "01100" ;
  $barcodes[7] = "00011" ;
  $barcodes[8] = "10010" ;
  $barcodes[9] = "01010" ;
  for($f1=9;$f1>=0;$f1--){ 
    for($f2=9;$f2>=0;$f2--){  
      $f = ($f1 * 10) + $f2 ;
      $texto = "" ;
      for($i=1;$i<6;$i++){ 
        $texto .=  substr($barcodes[$f1],($i-1),1) . substr($barcodes[$f2],($i-1),1);
      }
      $barcodes[$f] = $texto;
    }
  }
//Desenho da barra
//Guarda inicial
?><img src=img/p.png width=<?php echo $fino?> height=<?php echo $altura?> border=0><img 
src=img/b.png width=<?php echo $fino?> height=<?php echo $altura?> border=0><img 
src=img/p.png width=<?php echo $fino?> height=<?php echo $altura?> border=0><img 
src=img/b.png width=<?php echo $fino?> height=<?php echo $altura?> border=0><img 
<?php
$texto = $valor ;
if((strlen($texto) % 2) <> 0){
    $texto = "0" . $texto;
}
// Draw dos dados
while (strlen($texto) > 0) {
  $i = round(esquerda($texto,2));
  $texto = direita($texto,strlen($texto)-2);
  $f = $barcodes[$i];
  for($i=1;$i<11;$i+=2){
    if (substr($f,($i-1),1) == "0") {
      $f1 = $fino ;
    }else{
      $f1 = $largo ;
    }
?>
    src=img/p.png width=<?php echo $f1?> height=<?php echo $altura?> border=0><img 
<?php
    if (substr($f,$i,1) == "0") {
      $f2 = $fino ;
    }else{
      $f2 = $largo ;
    }
?> src=img/b.png width=<?php echo $f2?> height=<?php echo $altura?> border=0><img 
<?php
  }
}
// Draw guarda final
?>src=img/p.png width=<?php echo $largo?> height=<?php echo $altura?> border=0><img 
src=img/b.png width=<?php echo $fino?> height=<?php echo $altura?> border=0><img 
src=img/p.png width=<?php echo 1?> height=<?php echo $altura?> border=0>  
?>
  • the code above is from the file siclop-enviar_boleto\pdf\mpdf.php?

  • No. This code is from another page. From funcoes_itau.php, which we pulled to the boleto_manual.php by include.

  • In intermediate files (which are included), you cannot close the tag ?>. In fact, no PHP script is recommending doing this but it generates the problem it received. Please see if it solves.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.