please help with this fpdf label printing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LordMerlin
    New Member
    • Dec 2005
    • 1

    please help with this fpdf label printing

    Hi

    I'm trying to write a label printing routine, but I'm not being too sucsessful. I'm hoping maybe someone who's used FPDF b4 can help me out?

    Basically, I want to print labels from a data taken from a MySQL DB, but it doesn't output the labels properly. As soon as it gets to the bottom of the page, it kinda spans the bottom two labels across the two pages. How do I tell it to print the whole last label on the second page? I had a look at the docs, but can't seem to get anything that'll help me.

    [PHP]
    include_once("c lasses/fpdf.php");
    define('FPDF_FO NTPATH','classe s/font/');




    $pdf=new FPDF('P','mm',$ _GET['paper_size']);
    $pdf->SetDisplayMode (fullpage);

    $pdf->AddPage();

    $pdf->SetFont('Arial ','B',12);
    $pdf->SetAutoPageBre ak('on');
    $pdf->SetTopMargin(0 );
    $pdf->SetLeftMargin( 0);



    $a = $row['name'];
    $b = "Expires: ".$row['expire'];
    $c = "Take ".$row['dosage'];
    $d = "No ".$no." / Pages ".$pages;
    $e = $_GET['l_gap']." / ".$_GET['t_gap']." / ".$_GET['width']." / ".$_GET['height'];

    $width =$_GET['l_gap'];
    $height =$_GET['t_gap'];


    for($i=1; $i<$_GET['label_quantity ']; $i++) {
    //$width = $width+$width+$ _GET['v_gap'];
    $height = $Ypos+$_GET['h_gap'];

    //First Column
    $pdf->SetXY($width,$ height);
    $pdf->MultiCell($_GE T['width'], $_GET['height']/10 ,$pdf->GetX()." / ".$pdf->GetY(). " ".$a."\n".$b."\ n".$c."\n".$d." \n".$e." #".$i , 1,'L');
    $Ypos = $pdf->GetY();
    //Second Column
    //$pdf->SetXY($_GET['l_gap']+$_GET['width']+$_GET['v_gap'],$height);
    //$pdf->MultiCell($_GE T['width'], $_GET['height']/10 ,$pdf->GetX()." / ".$pdf->GetY(). " ".$a."\n".$b."\ n".$c."\n".$d." \n".$e." #".$i , 1,'L');

    }


    $pdf->Output();[/PHP]

    My other problem, which I don't know howto address yet, is how would I be able to print a few labels next to each other?

    tia :)
    Attached Files
  • azang
    New Member
    • Sep 2007
    • 3

    #2
    I think you can simply adjust the space between the labels. i.e. use $pdf->Ln(5);

    [link removed]
    Last edited by MMcCarthy; Sep 15 '07, 11:32 PM. Reason: link removed by Admin

    Comment

    • Weisbartb
      New Member
      • Aug 2007
      • 36

      #3
      I actually just wrote a major application using this. Its very useful but also has a lot of short comings.
      Since your data is not dynamically changing in lines you probably can just use the addPage() function from fpdf after the 8th item is printed. This class is not an easy one to use.

      Comment

      Working...