function AgregaManifiesto(MyPDFFile &$pdf, DOMElement $nodoManifiesto, $coords)
{
    $pdf->AddPage("P", "Letter");
    $pdf->SetFont("Arial", "", 9.5);
    $pdf->SetMargins(0, 0, 0);
    $pdf->SetAutoPageBreak(false, 0);
    $generalX = $coords["general"]["posicion"]["x"];
    $generalY = $coords["general"]["posicion"]["y"];
    foreach ($nodoManifiesto->getElementsByTagName("data") as $data) {
        $elem = $data->getAttribute("name");
        $cont = $data->nodeValue;
        $pos = ObtieneCoordenadas($elem, $coords);
        if ($pos !== false && is_array($pos)) {
            $cont = utf8_decode($cont);
            $pdf->Texto($pos[0] + $generalX, $pos[1] + $generalY, $cont);
        }
    }
}
<?php

require "pdf/fpdf.php";
require "pdf/MyPDFFile.class.php";
$dir_in = "../files/download/";
$dir_out = "../files/download/";
$dir_template = "../files/templates/";
$archivo = isset($_GET["arch"]) && $_GET["arch"] != "" && file_exists($dir_in . $_GET["arch"]) ? $_GET["arch"] : "";
$coords = file_exists($dir_template . "coordenadas_manifiesto.json") ? json_decode(file_get_contents($dir_template . "coordenadas_manifiesto.json"), true) : "";
if ($archivo != "" && $coords != "") {
    $xml = new DOMDocument();
    $xml->load($dir_in . $archivo);
    $pdf = new MyPDFFile("L", "mm", "Letter");
    $pdf->SetFont("Arial", "", 9.5);
    $pdf->SetMargins(7, 10, 7);
    $pdf->SetAutoPageBreak(true, 10);
    CreaEncabezadoPagina($pdf, $xml);
    foreach ($xml->getElementsByTagName("manifiesto") as $k => $manifiesto) {
        $fila = $k + 1;
        $data = array($fila);
        foreach ($manifiesto->getElementsByTagName('data') as $nodo) {
            if ($nodo->getAttribute('name') == "manifiesto_space_nocte") {
                array_push($data, $nodo->nodeValue);
                break;
            }
        }
        foreach ($manifiesto->getElementsByTagName('data') as $nodo) {
            if ($nodo->getAttribute('name') == "manifiesto_space_nogen") {
                array_push($data, $nodo->nodeValue);
                break;
            }