P
I add to the reason why the code is built in this way, I manage two files, one to call two "methods" to build the pdf, not in output by download the file and the other by impression on the screen, in this way I have the base file that is responsible for creating the pdf petition:switch ($botonPresionado){
case 'DescargarResguardo':
$pdf = new PDF('L'); // creas el nuevo pdf
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAutoPageBreak(1, 10); // Corta la pagina en la posicion indicada
$pdf->SetFont('Arial', '', 5);
$pdf->Header(); // este es solo en caso que requieras que aparezca en todas las hojas como cabecera, si no ocupas este header, tienes que sacar de ahí el código que te genera las dos tablas
$pdf->SetFont('Arial', '', 5);
// Títulos de las columnas
$header = array('No.', 'MUNICIPIO', 'NUMERO_ACTIVO', 'SUBNUMERO', 'DESCRIPCIÓN DEL BIEN', 'MATERIAL', 'COLOR', 'MARCA', 'MODELO', 'SERIE', 'ESTADO DEL BIEN'); // cabecera de la tabla de información
// Carga de la tabla
$pdf->ActivosTable($header); Aqui carga la tabla con su cabecera
$pdf->datos_usuarios(); // carga otros datos relacionados al formato
// Aquí hago una instancia para accesar a Mysql
// Aquí un for para obtener los datos de salida del nombre del archivo
$pdf->Output('RESGUARDO INDIVIDUAL-'.$Numero_Empleado.'-'.$nombre_EmpleadoRH .'-'. date('d-m-Y') .'.pdf', 'D');
break;
case 'ImprimirResguardo':</code></pre></div></div></p><p>This is the way I place two horizontal and aligned tables of information based on positions within the print page(coordinated if you want to see it like this)</p><pre><code> class PDF extends FPDF {
function Header()
{
// Logo
$this->Image('imagenes/logos/FondoResguardo2.jpg',0,0,300,0);
// Arial bold 15
$this->SetFont('Arial','B',6);
// Aquí hago mis instancias para poder cargar los datos//
for($rh=0; $rh< $totalResultadoListaRecursoshumanos; $rh++){
//Aquí hago un recorrido de la consulta para asignar los valores a cada variable
} // esto de arriba de las instancias y el recorrido a lo mejor no es necesario para ti
$this->SetFont('','B');
$fill = True;
$this->SetXY(10,42);//Esquina del inicio del margen de la cabecera dependencia //
$posicion_MulticeldaDX= $this->GetX();//Aquí inicializo donde va a comenzar el primer recuadro en la posición X
$posicion_MulticeldaDY= $this->GetY();//Aquí inicializo donde va a comenzar el primer recuadro en la posición Y
//Estas lineas comentadas las ocupo para verificar la posición, imprime la posición de cada eje//
//$this->Cell(50,5,utf8_decode('Posicion X' ." " .$posicion_MulticeldaDX),1,0,'C');
//$this->Cell(50,5,utf8_decode('Posicion Y' ." " .$posicion_MulticeldaDY),1,0,'C');
//-------------------------------------------------------------------------//
//**************************************************************************//
// Estas lineas son para asignar relleno, color del texto y color de lineas de contorno si mal no recuerdo //
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetDrawColor(224,235,255);
//*************************************************************************//
$this->SetXY($posicion_MulticeldaDX,$posicion_MulticeldaDY); //Aquí le indicas la posición de la esquina superior izquierda para el primer multicell que envuelve toda la tabla o recuadro
$this->MultiCell(137,25,'',1);
$this->SetXY($posicion_MulticeldaDX,$posicion_MulticeldaDY); // Esto posiciona cada etiqueta en base a la posición de la esquina
$this->Cell(137,5,'DATOS DE LA DEPENDENCIA', 1,1,'C',$fill);
$this->SetXY($posicion_MulticeldaDX,$posicion_MulticeldaDY+5);
$this->Cell(137,5,'DEPENDENCIA:', 0,1,'L');
$this->SetXY($posicion_MulticeldaDX+35,$posicion_MulticeldaDY+5);
$this->Cell(80,5,utf8_decode($nombreInstitutoRH),0,1,'L',0);
$this->SetXY($posicion_MulticeldaDX,$posicion_MulticeldaDY+10);
$this->Cell(137,5,'UR:', 0,1,'L');
$this->SetXY($posicion_MulticeldaDX+35,$posicion_MulticeldaDY+10);
$this->Cell(80,5,utf8_decode($nombreUnidadResponsableRH) ,0,1,'L',0);
$this->SetXY($posicion_MulticeldaDX,$posicion_MulticeldaDY+15);
$this->Cell(137,5,utf8_decode('DIRECCIÓN GENERAL:'), 0,1,'L');
$this->SetXY($posicion_MulticeldaDX+35,$posicion_MulticeldaDY+15);
$this->Cell(80,5,utf8_decode('DIRECCIÓN DE ADMINISTRACION Y FINANZAS' ),0,1,'L',0);
$this->SetXY($posicion_MulticeldaDX,$posicion_MulticeldaDY+20);
$this->Cell(137,5,utf8_decode('DIRECCIÓN DE AREA:'), 0,1,'L');
$this->SetXY($posicion_MulticeldaDX+35,$posicion_MulticeldaDY+20);
$this->Cell(80,5,utf8_decode($nombreUnidadRH),0,1,'L',0);
$this->Ln(); // Termina seccion de multicelda de datos de dependencia
$this->SetFont('','B');
$fill = True;
$this->SetXY(153,42); // Esquina del unicio de la cabecera del usuario//
$posicion_MulticeldaUX= $this->GetX();
$posicion_MulticeldaUY= $this->GetY();
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetDrawColor(224,235,255);
$this->SetXY($posicion_MulticeldaUX,$posicion_MulticeldaUY);
$this->MultiCell(137,25,'',1);
$this->SetXY($posicion_MulticeldaUX,$posicion_MulticeldaUY);
$this->Cell(137,5,'DATOS DEL USUARIO', 1,1,'C',$fill);
$this->SetXY($posicion_MulticeldaUX,$posicion_MulticeldaUY+5);
$this->Cell(137,5,'NUMERO DE EMPLEADO:', 0,1,'L');
$this->SetXY($posicion_MulticeldaUX+40,$posicion_MulticeldaUY+5);
$this->Cell(80,5,utf8_decode($numero_EmpleadoRH),0,1,'L',0);
$this->SetXY($posicion_MulticeldaUX,$posicion_MulticeldaUY+10);
$this->Cell(137,5,'NOMBRE DE EMPLEADO:', 0,1,'L');
$this->SetXY($posicion_MulticeldaUX+40,$posicion_MulticeldaUY+10);
$this->Cell(80,5,utf8_decode($nombre_EmpleadoRH),0,1,'L',0);
$this->SetXY($posicion_MulticeldaUX,$posicion_MulticeldaUY+15);
$this->Cell(137,5,'NIVEL TABULAR:', 0,1,'L');
$this->SetXY($posicion_MulticeldaUX+40,$posicion_MulticeldaUY+15);
$this->Cell(80,5,utf8_decode($nivel_TabularRH),0,1,'L',0);
$this->SetXY($posicion_MulticeldaUX,$posicion_MulticeldaUY+20);
$this->Cell(137,5,'CATEGORIA O PUESTO:', 0,1,'L');
$this->SetXY($posicion_MulticeldaUX+40,$posicion_MulticeldaUY+20);
$this->Cell(80,5,utf8_decode($puestoNominalRH),0,1,'L',0);
$this->Ln();
//$this->Cell(185,5,'', 0,1,'L');
$posicion_CierreCeldaCabeceraX = $this->GetX();
$posicion_CierreCeldaCabeceraY = $this->GetY();
//$this->Cell(50, 5, utf8_decode('Posicion X' . " " . $posicion_CierreCeldaCabeceraX), 1, 0, 'C');
//$this->Cell(50, 5, utf8_decode('Posicion Y' . " " . $posicion_CierreCeldaCabeceraY), 1, 0, 'C');
}
In this way two squares or boards can be placed horizontallyAnd this is the view you get. You can adapt this code to your need, do not require the $this-give if you are working on the same file to create the pdf. Just use the $pdf-giveSetXY(10,42);//Skip from the beginning of the margin of the first table, this assigns you the first point of origin, now you also have to play with the numbers as this is the position that I have on the basis of a pair of logos and a text header that consume me 42 spaces from the beginning of the page. Maybe you need it to be $pdf-giveSetXY(5,5); or $pdf-giveSetXY(10,10);.Greetings