带有 fpdf 的第二个 pdf 表没有正确出现

问题描述

求助,第一张纸正确出来,但第二张没有,我得到了几张纸 我希望有人能帮我解决这个问题 由于我是新人,只有那个错误,从第二页开始,一切都被扭曲了 我附上我的代码,看看他们是否可以帮助我 我已经尝试了所有方法但它一直出现并且我没有找到具有相同错误页面

    <?PHP

class Pdfhojavida extends FPDF{

function Head($y){
    //Margen
    $this->Setlinewidth(0.1);
    $this->SetFillColor(255);
    $x=5; $y+=5; $w=50; $h=60;
    $this->Image('../public/img/logo.jpeg',$x,$y,$w,$h,'jpeg','');
    // $this->Cell(0,20,utf8_decode('REGISTRO DIARIO DE PACIENTES EN CONSULTA EXTERNA'),'C');
    

    // $this->SetTextColor(0,0);
    $y+=5;
    $this->setY($y);
    $this->setX(158);
    $this->SetFont('Arial','B',10);
    $this->Cell(50,10,'FECHA IMPRESION: '.date('Y-m-d'),'L');
    // $this->Cell(50,'SIS-Demo-ECE','L');
    $y+=5;
    $this->setY($y);
    $this->setX(5);
    $this->SetFont('Arial',12);
    $this->SetTextColor(0,0);
    $this->Cell(0,utf8_decode('HOJA DE VIDA DE LA MASCOTA'),'C');
    
}
function Top($y,$dataconsulta){
    $x = 6;
    $this->setY($y);
    $this->setX($x);
    $this->SetFont('Arial',8);
    $this->Cell(30,5,utf8_decode('Fecha nacimiento'),1,'C');
    $this->ln(5);
    $this->setX($x);
    $this->SetFont('Arial','',7);
    $this->Cell(30,$dataconsulta[0]->fechaNac,'L');

    $x = $this->GetY() + $x;
    $this->setY($y);
    $this->setX($x-9);
    $this->SetFont('Arial',8);
    $this->Cell(40,utf8_decode('Mascota'),'C');
    $this->ln(5);
    $this->setX($x-9);
    $this->SetFont('Arial',7);
    $this->Cell(40,utf8_decode($dataconsulta[0]->mascota),'L');
    
    $x = $this->GetY() + $x;
    $this->setY($y);
    $this->setX($x-8);
    $this->SetFont('Arial',utf8_decode('Especie'),'C');
    $this->ln(5);
    $this->setX($x-8);
    $this->SetFont('Arial',utf8_decode($dataconsulta[0]->especie),'L');
    
    $x = $this->GetY() + $x;
    $this->setY($y);
    $this->setX($x-7);
    $this->SetFont('Arial',utf8_decode('Raza'),'C');
    $this->ln(5);
    $this->setX($x-7);
    $this->SetFont('Arial',utf8_decode($dataconsulta[0]->raza),'L');
    
    $x = $this->GetY() + $x;
    $this->setY($y);
    $this->setX($x-16);
    $this->SetFont('Arial',8);
    $this->Cell(60,utf8_decode('Cliente'),'C');
    $this->ln(5);
    $this->setX($x-16);
    $this->SetFont('Arial',7);
    $this->Cell(60,utf8_decode($dataconsulta[0]->nombre_cliente),'L');
    
}
function Body($y,$dataservicio,$arrayServicios){

    $x = 6;
    $this->setY($y);
    $this->setX($x);
    $this->SetFont('Arial',12);
    $this->Cell(30,6,utf8_decode('Registro de Consultas'),'L');
    $this->ln();
  
    $y += 8;       

    foreach ($dataservicio['consultas'] as $ll => $consulta) {
                
        $key = 0;
        $this->setY($y);
        $this->setX($x);
        $this->SetFont('Arial',10);
        $this->Cell(177,utf8_decode('Fecha Consulta: '). $consulta[$key]->fecha,'C');
        $this->SetFont('Arial',10);
        $this->Cell(200,utf8_decode('Peso: '). $consulta[$key]->pesoMascota.' KG','L');

        $y += 8;
        
        $this->setY($y);
        $this->setX($x);  
        $this->SetFont('Arial',8);
        $this->Cell(84,utf8_decode('Servicio'),'L');
        $this->SetFont('Arial',8);
        $this->Cell(90,utf8_decode('Observación'),8);
        $this->Cell(30,utf8_decode('Precio Sugerido'),'L');           
        
        $this->ln();
        $total = 0;
        $y += 6;
        foreach ($arrayServicios[$ll]as $kk => $servicio) {
                            
            if($consulta[$key]->id == $servicio->id){
                
                    $this->setY($y);
                    $this->setX($x);        
                    $this->SetFont('Arial',8);
                    $this->Cell(84,utf8_decode($servicio->servicio),'L');      
                    $this->Cell(90,utf8_decode($servicio->observacion),'L');  
                    $this->Cell(30,utf8_decode($servicio->precio).' Soles','L');
                    $this->ln();                
                    $y += 6;
                
            }
            $total +=  $servicio->precio;
        }
        $this->setY($y);
        $this->setX($x+149);   
        $this->SetFont('Arial',10);
        $this->Cell(25,utf8_decode('Total'),'R');      
        $this->Cell(30,$total.' Soles','L');    

        $y += 5;
        $this->setY($y);
        $this->setX($x);
       

    }
        
}  

}

example 1 example 2

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)