php - 带有 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'),0,0,'C');
// $this->SetTextColor(0,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'),0,0,'L');
// $this->Cell(50,10,'SIS-Demo-ECE',0,0,'L');
$y+=5;
$this->setY($y);
$this->setX(5);
$this->SetFont('Arial','B',12);
$this->SetTextColor(0,0,0);
$this->Cell(0,20,utf8_decode('HOJA DE VIDA DE LA MASCOTA'),0,0,'C');
}
function Top($y,$dataconsulta){
$x = 6;
$this->setY($y);
$this->setX($x);
$this->SetFont('Arial','B',8);
$this->Cell(30,5,utf8_decode('Fecha nacimiento'),1,0,'C');
$this->ln(5);
$this->setX($x);
$this->SetFont('Arial','',7);
$this->Cell(30,5,$dataconsulta[0]->fechaNac,1,0,'L');
$x = $this->GetY() + $x;
$this->setY($y);
$this->setX($x-9);
$this->SetFont('Arial','B',8);
$this->Cell(40,5,utf8_decode('Mascota'),1,0,'C');
$this->ln(5);
$this->setX($x-9);
$this->SetFont('Arial','',7);
$this->Cell(40,5,utf8_decode($dataconsulta[0]->mascota),1,0,'L');
$x = $this->GetY() + $x;
$this->setY($y);
$this->setX($x-8);
$this->SetFont('Arial','B',8);
$this->Cell(40,5,utf8_decode('Especie'),1,0,'C');
$this->ln(5);
$this->setX($x-8);
$this->SetFont('Arial','',7);
$this->Cell(40,5,utf8_decode($dataconsulta[0]->especie),1,0,'L');
$x = $this->GetY() + $x;
$this->setY($y);
$this->setX($x-7);
$this->SetFont('Arial','B',8);
$this->Cell(30,5,utf8_decode('Raza'),1,0,'C');
$this->ln(5);
$this->setX($x-7);
$this->SetFont('Arial','',7);
$this->Cell(30,5,utf8_decode($dataconsulta[0]->raza),1,0,'L');
$x = $this->GetY() + $x;
$this->setY($y);
$this->setX($x-16);
$this->SetFont('Arial','B',8);
$this->Cell(60,5,utf8_decode('Cliente'),1,0,'C');
$this->ln(5);
$this->setX($x-16);
$this->SetFont('Arial','',7);
$this->Cell(60,5,utf8_decode($dataconsulta[0]->nombre_cliente),1,0,'L');
}
function Body($y,$dataservicio,$arrayServicios){
$x = 6;
$this->setY($y);
$this->setX($x);
$this->SetFont('Arial','B',12);
$this->Cell(30,6,utf8_decode('Registro de Consultas'),0,0,'L');
$this->ln();
$y += 8;
foreach ($dataservicio['consultas'] as $ll => $consulta) {
$key = 0;
$this->setY($y);
$this->setX($x);
$this->SetFont('Arial','B',10);
$this->Cell(177,6,utf8_decode('Fecha Consulta: '). $consulta[$key]->fecha,0,0,'C');
$this->SetFont('Arial','B',10);
$this->Cell(200,6,utf8_decode('Peso: '). $consulta[$key]->pesoMascota.' KG',0,0,'L');
$y += 8;
$this->setY($y);
$this->setX($x);
$this->SetFont('Arial','B',8);
$this->Cell(84,6,utf8_decode('Servicio'),1,0,'L');
$this->SetFont('Arial','B',8);
$this->Cell(90,6,utf8_decode('Observación'),1,0,'L');
$this->SetFont('Arial','B',8);
$this->Cell(30,6,utf8_decode('Precio Sugerido'),1,0,'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,6,utf8_decode($servicio->servicio),1,0,'L');
$this->Cell(90,6,utf8_decode($servicio->observacion),1,0,'L');
$this->Cell(30,6,utf8_decode($servicio->precio).' Soles',1,0,'L');
$this->ln();
$y += 6;
}
$total += $servicio->precio;
}
$this->setY($y);
$this->setX($x+149);
$this->SetFont('Arial','B',10);
$this->Cell(25,6,utf8_decode('Total'),1,0,'R');
$this->Cell(30,6,$total.' Soles',1,0,'L');
$y += 5;
$this->setY($y);
$this->setX($x);
}
}
}
解决方案
推荐阅读
- typescript - 检测 jsdoc 错误并提交失败
- python - 检查列并乘以其他不同的长度
- redis - 如何知道有多少客户端连接到redis流
- java - InvalidModuleDescriptorException 导致启动层初始化时出错
- flutter - 颤振:广告未能加载:1
- z3 - Z3 如何检查模型是否满足新的断言/约束
- python - 给定一个名称列表,输出一个列表,其中仅包含包含超过 5 个字符的名称
- lightbox2 - .SVG - 文件未在 IE 中显示
- pyspark - 如何使用 UDF 在 PySpark 中合并多边形
- javascript - Cropper.js 固定图像宽度高度