<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$formname = 'Label Print';


$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

$zroot = $_SESSION["zdbroot"];

$descrip = $_POST["descrip"];
$noline = $_POST["noline"];


require ('library/fpdf/code128.php');


$ht = 13;
$f = 9;

$pdf = new PDF_Code128('P', 'mm', array(205, 350));

// $pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 18);
$pdf->SetTextColor(0, 0, 0);

$pdf->SetY(4);

$addln = 0;

$pdf->SetFont('Arial', '', $f);
for ($i = 1; $i <= $noline; $i++) {

    $addln++;
    $pdf->Cell(5,  $ht, "", 0, 0, 'L');
    $pdf->Cell(39, $ht, "$descrip", 0, 0, 'L');
    $pdf->Cell(39, $ht, "$descrip", 0, 0, 'L');
    $pdf->Cell(39, $ht, "$descrip", 0, 0, 'L');
    $pdf->Cell(39, $ht, "$descrip", 0, 0, 'L');
    $pdf->Cell(39, $ht, "$descrip", 0, 0, 'L');
    $pdf->Ln(13);
    
    if ($addln == 5 ){
        $pdf->Ln(1);
//        $addln = 0;
    }
    
}

ob_end_clean();
$pdf->Output("$formname" . ".pdf", "I");
