Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 标题fpdf中的空变量_Php_Html_Pdf - Fatal编程技术网

Php 标题fpdf中的空变量

Php 标题fpdf中的空变量,php,html,pdf,Php,Html,Pdf,我尝试在标题中显示一个变量,如发票,但不起作用,我使用FPDF,但字段$ordenTrabajo为空,我尝试了以下方法: <?php $ordenTrabajo=$_POST['oT_Escondido']; ob_end_clean(); // the buffer and never prints or returns anything. ob_start(); // it starts buffering class PDF extends

我尝试在标题中显示一个变量,如发票,但不起作用,我使用FPDF,但字段
$ordenTrabajo
为空,我尝试了以下方法:

<?php


    $ordenTrabajo=$_POST['oT_Escondido'];

    ob_end_clean(); //    the buffer and never prints or returns anything.
    ob_start(); // it starts buffering
    class PDF extends FPDF
    {
    // Cabecera de página



    function Header()
    {
        // Logo
        //$this->Image('../dist/img/logo.jpg',10,8,33);
        // Arial bold 15
        $this->SetFont('Arial','B',15);
        // Movernos a la derecha
        $this->Cell(80);
        // Título
        $this->Cell(120,10,'Control de Empaques IKOR PUNTARENAS SA',0,1,'C');

        $this->SetFont('Arial','B',12);
        // Salto de línea
        $this->Ln(10);
        $this->Cell(40,10,'Orden de Trabajo: ',0,0);
        $this->Cell(40, 10, "GORE-5265", 0, 0);
        $this->Cell(13,10,'OC#: ',0,0);
        $this->Cell(40, 10, "OC-123456789", 0, 0);
        $this->Cell(30,10,'Peso: ',0,0);
        $this->Cell(40, 10, "19,45 KG", 0,0 );
        $this->Cell(50,10,'Cantidad de Cajas: ',0,0);
        $this->Cell(30, 10, "1000", 0, 1);

        $this->Cell(20,10,'Lote: ',0,0);
        $this->Cell(40, 10,'123456789', 0, 0);
        $this->Cell(50,10,'Numero de Parte: ',0,0);
        $this->Cell(40, 10, "PARTE-999999", 0, 0);
        $this->Cell(40,10,'Filtros por caja: ',0,0);
        $this->Cell(20, 10, "11", 0,0 );
        $this->Cell(50,10,'Cantidad de Filtros: ',0,0);
        $this->Cell(30, 10, "9999", 0, 1);
        $this->Ln(15);
        $this->Line(80, 45, 100, 45); // 20mm from each edge
        $this->Line(50, 45, 210-50, 45); // 50mm from each edge

    }

    public function setLote($name){
        $this->name = $name;
    }

    // Pie de página
    function Footer()
    {
        // Posición: a 1,5 cm del final
        $this->SetY(-15);
        // Arial italic 8
        $this->SetFont('Arial','I',8);
        // Número de página
        //$this->Cell(300,10,'7FMIKO-022 REV.02',0,0,'C');
        $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
        $this->Cell(-15,10,'7FMIKO-022 REV.02',0,0,'C');
    }
    }

    // Creación del objeto de la clase heredada
    $pdf = new PDF('L');
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont('Times','',12);
    $pdf->Cell(30,10,$ordenTrabajo,0,1);
    $pdf->Output();
    ob_end_flush(); // It's printed here, because ob_end_flush "prints" what's in
                  // the buffer, rather than returning it
                  //     (unlike the ob_get_* functions)
    ?>

此方法用于呈现页眉。它由AddPage()自动调用,不应由应用程序直接调用。FPDF中的实现为空,因此如果需要特定处理,必须对其进行子类化并重写该方法

资料来源:

$ordenTrabajo=$_POST['oT_Escondido'];

ob_end_clean(); //    the buffer and never prints or returns anything.
ob_start(); // it starts buffering
class PDF extends FPDF
{
// Cabecera de página



function Header()
{
    global $ordenTrabajo;
    // Logo
    //$this->Image('../dist/img/logo.jpg',10,8,33);
    // Arial bold 15
    $this->SetFont('Arial','B',15);
    // Movernos a la derecha
    $this->Cell(80);
    // Título
    $this->Cell(120,10,'Control de Empaques IKOR PUNTARENAS SA',0,1,'C');

    $this->SetFont('Arial','B',12);
    // Salto de línea
    $this->Ln(10);
    $this->Cell(40,10,'Orden de Trabajo: ',0,0);
    $this->Cell(40, 10, "GORE-5265", 0, 0);
    $this->Cell(13,10,'OC#: ',0,0);
    $this->Cell(40, 10, "OC-123456789", 0, 0);
    $this->Cell(30,10,'Peso: ',0,0);
    $this->Cell(40, 10, "19,45 KG", 0,0 );
    $this->Cell(50,10,'Cantidad de Cajas: ',0,0);
    $this->Cell(30, 10, "1000", 0, 1);

    $this->Cell(20,10,'Lote: ',0,0);
    $this->Cell(40, 10,$ordenTrabajo, 0, 0);
    $this->Cell(50,10,'Numero de Parte: ',0,0);
    $this->Cell(40, 10, "PARTE-999999", 0, 0);
    $this->Cell(40,10,'Filtros por caja: ',0,0);
    $this->Cell(20, 10, "11", 0,0 );
    $this->Cell(50,10,'Cantidad de Filtros: ',0,0);
    $this->Cell(30, 10, "9999", 0, 1);

}