PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 21st, 2011, 10:39 AM
aadebayo aadebayo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 17 aadebayo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 28 sec
Reputation Power: 0
Labels,Pdf,fpdf

Labels with PHP,fpdf Issue
Expand Post »
Hello

I have almost completed the code for pdf_labels. However, I am stuck on the fronts. First, the format is not exactly as it should be. Please follow the following URL to see what I am talking about.This is the Label Site As you can see, it starts with label 5 instead of 1, then labels 1 -4 are "doubled up" on labels 21 - 24. Below is the code that the labels currently uses



PHP Code:
function PDF_Label($format$unit='mm'$posX=1$posY=1) {
         if (
is_array($format)) {
         
// Custom format
         
$Tformat $format;
         } else {
         
// Built-in format
         
if (!isset($this->_Avery_Labels[$format]))
         
$this->Error('Unknown label format: '.$format);
         
$Tformat $this->_Avery_Labels[$format];
        }
       
  
      
parent::FPDF('L'$unit$Tformat['paper-size']);
      
$this->_Metric_Doc $unit;
      
$this->_Set_Format($Tformat);
      
$this->SetFont('Arial');
      
$this->SetMargins(0,0);
      
$this->SetAutoPageBreak(false);
     
$this->_COUNTX $posX-2;
     
$this->_COUNTY $posY-1;
     } 


Please help

Reply With Quote
  #2  
Old December 21st, 2011, 12:50 PM
SecurityDavid SecurityDavid is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 170 SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 2 h 34 m 47 sec
Reputation Power: 53
Change this:
Quote:
Originally Posted by aadebayo
PHP Code:
function PDF_Label($format$unit='mm'$posX=1$posY=1) {
         if (
is_array($format)) {
         
// Custom format
         
$Tformat $format;
         } else {
         
// Built-in format
         
if (!isset($this->_Avery_Labels[$format]))
         
$this->Error('Unknown label format: '.$format);
         
$Tformat $this->_Avery_Labels[$format];
        } 
To this:
PHP Code:
function PDF_Label($format$unit='mm'$posX=1$posY=1) {
         if (
is_array($format)) {
         
// Custom format
         
$Tformat $format;
         } else {
         
// Built-in format
                  
if (!isset($this->_Avery_Labels[$format])){
                           
$this->Error('Unknown label format: '.$format);
                           
$Tformat $this->_Avery_Labels[$format];
                  }
        } 
Or, better yet, change the if inside an if to simply an elseif.

I'm assuming you have a custom format rather than a built in format. If that is true, your $Tformat variable is getting reset to "$this->_Avery_Labels[$format];" every time your code is run because the if statement is only applying to the first line of code after the statement when you omit the braces.

That may not solve your problem, but it's a start.

Reply With Quote
  #3  
Old December 22nd, 2011, 02:04 AM
aadebayo aadebayo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 17 aadebayo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 28 sec
Reputation Power: 0
Thanks SecurityDavid. I have realised that I posted the wrong code . The code that generates the Label Site is below

PHP Code:
function Add_Label($text) {
        
$this->_COUNTY++;
        if (
$this->_COUNTY == $this->_Y_Number) {
            
// Row full, we start a new one
            
$this->_COUNTY=0;
            
$this->_COUNTY++;
            if ((
$this->_COUNTX ==0) and ($this->_COUNTY==0)) {
                
// End of page reached, we start a new one
                
$this->_COUNTX=0;
                
$this->AddPage();
            }
        }
        
        
$_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
        
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
        
$this->SetXY($_PosX$_PosY);
        
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$text0'L');
    } 

Reply With Quote
  #4  
Old December 23rd, 2011, 10:02 AM
SecurityDavid SecurityDavid is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 170 SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 2 h 34 m 47 sec
Reputation Power: 53
You may have to also post the code that calls this function. The part of this that I think is causing you problems is the COUNTX and COUNTY variables that you have here. As far as I can tell from the fpdf manual, those are not standard functions for fpdf. When I have needed to find and alter the X and Y positions in the past, I typically use the built-in GetX and GetY functions.

Another suggest that may help (I don't really know without seeing the rest) is that when i looked at the label site yesterday, page 2 started correctly because it was generated inside the function. In the function, you have your COUNTX and COUNTY variables set to "0" prior to adding a new page. You should make sure that even though it's a fresh document your new fpdf also has this set.
PHP Code:
 $pdf = new FPDF();
$pdf->_COUNTX=0;
$pdf->_COUNTY=0;
$pdf->AddPage(); 

Reply With Quote
  #5  
Old December 24th, 2011, 04:34 AM
aadebayo aadebayo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 17 aadebayo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by SecurityDavid
You may have to also post the code that calls this function. The part of this that I think is causing you problems is the COUNTX and COUNTY variables that you have here. As far as I can tell from the fpdf manual, those are not standard functions for fpdf. When I have needed to find and alter the X and Y positions in the past, I typically use the built-in GetX and GetY functions.

Another suggest that may help (I don't really know without seeing the rest) is that when i looked at the label site yesterday, page 2 started correctly because it was generated inside the function. In the function, you have your COUNTX and COUNTY variables set to "0" prior to adding a new page. You should make sure that even though it's a fresh document your new fpdf also has this set.
PHP Code:
 $pdf = new FPDF();
$pdf->_COUNTX=0;
$pdf->_COUNTY=0;
$pdf->AddPage(); 



Thanks SecurityDavid. I have tried your suggestion, but no difference so far.
The code that calls the LabelTest.php script is below

PHP Code:
require('PDF_Label.php');
$pdf = new PDF_Label('3422');

$pdf->AddPage('L');

// Print labels
for($i=1;$i<=40;$i++) {
    
$text sprintf("%s\n%s\n%s\n%s %s, %s""Laurent $i"'Immeuble Toto''av. Fragonard''06000''NICE''FRANCE');
    
$pdf->Add_PDF_Label($text);
}

$pdf->Output(); 



The one calling the Add_PDF_Label with your suggestion is

PHP Code:
 $this->_COUNTY++;
        if (
$this->_COUNTY == $this->_Y_Number) {
            
// Row full, we start a new one
            
$this->_COUNTY=0;
            
$this->_COUNTX++;
            if (
$this->_COUNTX == $this->_X_Number) {
                
// End of page reached, we start a new one
                //$this->_COUNTX=0;
                //$this->AddPage();
                 
$pdf = new FPDF();
                 
$this->_COUNTX=0;
                 
$this->_COUNTY=0;
                 
$this->AddPage();  
            }
        }
        
        
$_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
        
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
        
$this->SetXY($_PosX$_PosY);
        
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$text0'L'); 

Reply With Quote
  #6  
Old December 26th, 2011, 09:44 AM
SecurityDavid SecurityDavid is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 170 SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 2 h 34 m 47 sec
Reputation Power: 53
Try it this way:
PHP Code:
require('PDF_Label.php');
$pdf = new PDF_Label('3422');
//Add the COUNTX and COUNTY resets here, not in the label function.
$pdf->_COUNTX=0;
$pdf->_COUNTY=0;
$pdf->AddPage('L');

// Print labels
for($i=1;$i<=40;$i++) {
    
$text sprintf("%s\n%s\n%s\n%s %s, %s""Laurent $i"'Immeuble Toto''av. Fragonard''06000''NICE''FRANCE');
    
$pdf->Add_PDF_Label($text);
}

$pdf->Output(); 

PHP Code:
 $this->_COUNTY++;
        if (
$this->_COUNTY == $this->_Y_Number) {
            
// Row full, we start a new one
            
$this->_COUNTY=0;
            
$this->_COUNTX++;
            if (
$this->_COUNTX == $this->_X_Number) {
                
// End of page reached, we start a new one
                
$this->_COUNTX=0;
                
$this->AddPage();
                 
//This is not correct here. Leave this how you had it before. I intended this to go in the script above that calls the function.
                 //$pdf = new FPDF();
                 //$this->_COUNTX=0;
                 //$this->_COUNTY=0;
                 //$this->AddPage();  
            
}
        }
        
        
$_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
        
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
        
$this->SetXY($_PosX$_PosY);
        
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$text0'L'); 
Comments on this post
aadebayo agrees: Thanks for this post

Reply With Quote
  #7  
Old December 28th, 2011, 08:56 AM
aadebayo aadebayo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 17 aadebayo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 28 sec
Reputation Power: 0
PHP Code:
[QUOTE=SecurityDavid]Try it this way:[PHP]
require(
'PDF_Label.php');
$pdf = new PDF_Label('3422');
//Add the COUNTX and COUNTY resets here, not in the label function.
$pdf->_COUNTX=0;
$pdf->_COUNTY=0;
$pdf->AddPage('L');

// Print labels
for($i=1;$i<=40;$i++) {
    
$text sprintf("%s\n%s\n%s\n%s %s, %s""Laurent $i"'Immeuble Toto''av. Fragonard''06000''NICE''FRANCE');
    
$pdf->Add_PDF_Label($text);
}

$pdf->Output(); 

PHP Code:
 $this->_COUNTY++;
        if (
$this->_COUNTY == $this->_Y_Number) {
            
// Row full, we start a new one
            
$this->_COUNTY=0;
            
$this->_COUNTX++;
            if (
$this->_COUNTX == $this->_X_Number) {
                
// End of page reached, we start a new one
                
$this->_COUNTX=0;
                
$this->AddPage();
                 
//This is not correct here. Leave this how you had it before. I intended this to go in the script above that calls the function.
                 //$pdf = new FPDF();
                 //$this->_COUNTX=0;
                 //$this->_COUNTY=0;
                 //$this->AddPage();  
            
}
        }
        
        
$_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
        
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
        
$this->SetXY($_PosX$_PosY);
        
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$text0'L'); 
[/QUOTE]

SecurityDavid

Thanks a million times for your help, all I had to do is make a minor change and it worked perfectly. I am exceptionally grateful. Below is the new code just in case anyone else needs it. I have applied it to my database record (again I changed it slightly) and it works. Below is the pdf_label code



PHP Code:
function Add_Label($texte) {
        
// We are in a new page, then we must add a page
         
$this->_COUNTY++;
        if (
$this->_COUNTY == $this->_Y_Number) {
            
// Row full, we start a new one
            
$this->_COUNTY=0;
            
$this->_COUNTX++;
            if (
$this->_COUNTX == $this->_X_Number) {
                
// End of page reached, we start a new one
                //$pdf = new FPDF();
                
$this->_COUNTX=0;
                
$this->AddPage();
                 
//This is not correct here. Leave this how you had it before. I intended this to go in the script above that calls the function.
                 //$pdf = new FPDF();
                 //$this->_COUNTX=0;
                 //$this->_COUNTY=0;
                 //$this->AddPage();  
            
}
        }
        
        
$_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
        
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
        
$this->SetXY($_PosX$_PosY);
        
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$texte0'L');  
    } 



and below is the code that I applied to the labelTest



PHP Code:
require('PDF_Label.php');
$pdf = new PDF_Label('3422');
//Add the COUNTX and COUNTY resets here, not in the label function.
$pdf->_COUNTX=0;
$pdf->_COUNTY=-1;
$pdf->AddPage('L');

// Print labels
for($i=1;$i<=40;$i++) {
    
$text sprintf("%s\n%s\n%s\n%s %s, %s""Laurent $i"'Immeuble Toto''av. Fragonard''06000''NICE''FRANCE');
    
$pdf->Add_Label($text);
}

$pdf->Output(); 




and below is the one that I use for the database values

PHP Code:
require('PDF_Label.php');
// connect to the database
db_connect($mysql['username'], $mysql['password'], $mysql['database'],$mysql['host']);


//// if StartPeriod and EndPeriod set displays all records relevant records//////////////////////////////
$query        "select `members_HouseGroup`.`description` AS `description`,`members_HouseGroup`.`id` AS `housegroupID`,`members_users`.`id` AS `id`,`members_users`.`memberTypeID` AS `memberTypeID`,`members_users`.`firstname` AS `firstname`,`members_users`.`lastname` AS `lastname`,`members_users`.`marital_status` AS `marital_status`,`members_users`.`email` AS `email`,`members_users`.`homephone` AS `homephone`,`members_users`.`businessphone` AS `businessphone`,`members_users`.`mobilephone` AS `mobilephone`,`members_users`.`address1` AS `address1`,`members_users`.`address2` AS `address2`,`members_users`.`towns` AS `towns`,`members_users`.`postCode` AS `postCode`,`members_users`.`relationship` AS `relationship`,`members_users`.`username` AS `username`,`members_users`.`status` AS `status`,`members_users`.`marital_status` AS `marital`, members_memberType.description as MemberType from ((`members_users` left join`members_memberType` on((`members_memberType`.`id` = `members_users`.`memberTypeID`))) left join `members_HouseGroup` on((`members_HouseGroup`.`id` = `members_users`.`housegroupID`)) ) where (`members_users`.`firstname` = '') or ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) ) and `members_users`.`memberTypeID` > 1 and username not in (select username from members_spouseLink) order by members_users.lastname";
$queryMember mysql_query("select `members_HouseGroup`.`description` AS `description`,`members_HouseGroup`.`id` AS `housegroupID`,`members_users`.`id` AS `id`,`members_users`.`memberTypeID` AS `memberTypeID`,`members_users`.`firstname` AS `firstname`,`members_users`.`lastname` AS `lastname`,`members_users`.`marital_status` AS `marital_status`,`members_users`.`email` AS `email`,`members_users`.`homephone` AS `homephone`,`members_users`.`businessphone` AS `businessphone`,`members_users`.`mobilephone` AS `mobilephone`,`members_users`.`address1` AS `address1`,`members_users`.`address2` AS `address2`,`members_users`.`towns` AS `towns`,`members_users`.`postCode` AS `postCode`,`members_users`.`relationship` AS `relationship`,`members_users`.`username` AS `username`,`members_users`.`status` AS `status`,`members_users`.`marital_status` AS `marital`, members_memberType.description as MemberType from ((`members_users` left join`members_memberType` on((`members_memberType`.`id` = `members_users`.`memberTypeID`))) left join `members_HouseGroup` on((`members_HouseGroup`.`id` = `members_users`.`housegroupID`)) ) where (`members_users`.`firstname` = '') or ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) ) and `members_users`.`memberTypeID` > 1 and username not in (select username from members_spouseLink) order by members_users.lastname");
$result        = @mysql_query($query);
$row    mysql_fetch_array($result);
$numberMembers=mysql_num_rows($queryMember);



// Standard format
$pdf = new PDF_Label('3422');
$pdf->_COUNTX=0;
$pdf->_COUNTY=-1;
$pdf->AddPage('L');
//$pdf->AddPage();


// Print labels

do {
//for($i=1;$i<=$numberMembers;$i++) {
    
$firstname $row['firstname'];
    
$description $row['description'];
    
$houseGroup $row['description'];
    if (
$houseGroup == "NO Housegroup"){
        
$houseGroup "";
    }
    else
    {
        
$houseGroup $row['description'];
    }
    
    if ((
$row['memberTypeID'] > 4) && (!empty($houseGroup)))
    {
    
$space " ";
    
$leftBrac "(";
    
$rightBrac ")";
    
$HouseGroupType "Leaders";
    
$houseGroup $houseGroup.$space.$leftBrac.$HouseGroupType.$rightBrac;
    }
    elseif ((
$row['memberTypeID'] == 4) && (!empty($houseGroup)))
    {
    
$space " ";
    
$leftBrac "(";
    
$rightBrac ")";
    
$HouseGroupType "Assistant leaders";
    
$houseGroup $houseGroup.$space.$leftBrac.$HouseGroupType.$rightBrac;
    }
    elseif ((
$row['memberTypeID'] == 3) && (!empty($houseGroup)))
    {
    
$space " ";
    
$leftBrac "(";
    
$rightBrac ")";
    
$HouseGroupType "Co leaders";
    
$houseGroup $houseGroup.$space.$leftBrac.$HouseGroupType.$rightBrac;
    }
    elseif (!empty(
$houseGroup))
    {
    
$houseGroup $houseGroup;
    }
    if ((
$row['memberTypeID'] < 6) || ($row['memberTypeID'] > 8))
    {
        
$memberTypeDesc "";
    }
    else
    {
    
$memberTypeDesc $row['MemberType'];
    }
    
    if (
$housegroupID == 1)
    {
            
$houseGroup "";
    }
    
    
$membersSpouse mysql_query("SELECT firstname,email,mobilephone FROM members_users where username in (select username from members_spouseLink where spouseUserID='" $row['username'] . "' and spouseUserID != '' and spouseUserID is not null)");
    while ((
$rowMemberSpouse mysql_fetch_array($membersSpouse)) != false) {
    
$spfirstname $rowMemberSpouse['firstname'];

    if (!empty(
$spfirstname))
    {
    
$amp " & ";
    
$firstname $firstname.$amp.$spfirstname;
    
$spemail $rowMemberSpouse['email'];
    
$spmobile $rowMemberSpouse['mobilephone'];
    }
    }
    
$data $firstname ." ";
    
$data .=  $row['lastname'] ."\n";
    
    
    
$countChild 0;
    
$memberChildRecord mysql_query("select `members_users`.`id` AS `id`,`members_users`.`memberTypeID` AS `memberTypeID`,`members_users`.`firstname` AS `firstname`,`members_users`.`lastname` AS `lastname`,`members_users`.`marital_status` AS `marital_status`,`members_users`.`email` AS `email`,`members_users`.`homephone` AS `homephone`,`members_users`.`businessphone` AS `businessphone`,`members_users`.`mobilephone` AS `mobilephone`,`members_users`.`address1` AS `address1`,`members_users`.`address2` AS `address2`,`members_users`.`towns` AS `towns`,`members_users`.`postCode` AS `postCode`,`members_users`.`relationship` AS `relationship`,`members_users`.`username` AS `username`,`members_users`.`status` AS `status`,`members_users`.`marital_status` AS `marital`, group_concat(members_child.cfirstname  ORDER BY members_child.dateOfBirth SEPARATOR ' , ') as child from ((`members_users`  inner join members_child  on (members_child.username=members_users.username) ) ) where  (members_child.username = '" $row['username'] . "'  or (members_child.username1 = '" $row['username'] . "' and members_child.username1 != ''))  and ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) )  or members_users.firstname is null  group by members_child.username");
    
$DueSweepDate strftime('%d / %m / %Y',$row ['NextSweepDate']);
    

    


        
    
//get the spouse firstname
    
    
    //get the children records
     
while (($rowChild mysql_fetch_array($memberChildRecord)) != false) {
    
$numberChild=mysql_num_rows($memberChildRecord);
    
$leftBrac "(";
    
$rightBrac ")";
    
$child $rowChild['child'];
    
$child $leftBrac.$child.$rightBrac;
    if (
$rowChild['child'])$data .= $child "\n";
    }
    
$email "email: ";
    
$phone "phone: ";
    
$mobile "mobile: ";
    if (
$row['address1'])$data .= $row['address1'] ."\n";
    if (
$row['address2'])$data .= $row['address2'] ."\n";
    if (
$row['towns'])$data .= $row['towns'] ."\n";
    if (
$row['postCode'])$data .= $row['postCode'] ."\n";
    if (
$row['homephone'])$data .= $phone.$row['homephone'] ."\n";
    if (
$row['mobilephone'])$data .= $mobile.$row['mobilephone'] ."\n";
    if (
$spmobile)$data .= $mobile.$spmobile ."\n";
    
$spmobile "";
    if (
$row['email'])$data .= $email.$row['email'] ."\n";
    if (
$spemail)$data .= $email.$spemail ."\n";
    
$spemail "";
    if (
$houseGroup)$data .= $houseGroup ."\n";
    if (
$row['memberTypeDesc'])$data .= $row['memberTypeDesc'] ."\n";
    
$spemail "";
    
$query = ($data);
    
    
$text sprintf($query);    
    
    
$pdf->Add_Label($text);
    
} while (
$row mysql_fetch_array($result));

$pdf->Output(); 

Reply With Quote
  #8  
Old January 18th, 2012, 11:59 PM
Showman13 Showman13 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 3 Showman13 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 27 sec
Reputation Power: 0
reviving this thread

I know this thread is almost a month old, but I found it while searching for a way to do exactly what it appears this thread is covering.

My basic question before I invest alot of time in trying to make this work for me is this...

Is this designed to be able to be used for multiple situations with different avery forms, or is all of the code geared only for a specific application and only for a single form, the 3422 pdf label defined...?

I need to be able to extract mailing information from a mysql DB of product purchases and deliver them to the product fulfillment center in a format that they can simply print them to the avery 5160 label sheet 3 across and 10 up.

I've determined the best, most accurate output would be by creating a pdf and sending it to them to print.

Is this a possible outcome of these scripts, or should I keep looking...

Thanks in advance for your response.

Douglas

Reply With Quote
  #9  
Old January 19th, 2012, 03:32 AM
aadebayo aadebayo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 17 aadebayo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by Showman13
I know this thread is almost a month old, but I found it while searching for a way to do exactly what it appears this thread is covering.

My basic question before I invest alot of time in trying to make this work for me is this...

Is this designed to be able to be used for multiple situations with different avery forms, or is all of the code geared only for a specific application and only for a single form, the 3422 pdf label defined...?

I need to be able to extract mailing information from a mysql DB of product purchases and deliver them to the product fulfillment center in a format that they can simply print them to the avery 5160 label sheet 3 across and 10 up.

I've determined the best, most accurate output would be by creating a pdf and sending it to them to print.

Is this a possible outcome of these scripts, or should I keep looking...

Thanks in advance for your response.

Douglas


Douglas

You can customise the file to suit what you need. All you have to do is use the 5160 in place of the 3422 that I used. I do not know if I have answered your question?

Reply With Quote
  #10  
Old January 19th, 2012, 07:42 AM
Showman13 Showman13 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 3 Showman13 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 27 sec
Reputation Power: 0
Quote:
Originally Posted by aadebayo
Douglas

You can customise the file to suit what you need. All you have to do is use the 5160 in place of the 3422 that I used. I do not know if I have answered your question?


Yes, that was basically my question, and the answer I was hoping for.. Now I will take the time to see how I can implement it in my program.

Thanks

Reply With Quote
  #11  
Old January 19th, 2012, 08:56 AM
Showman13 Showman13 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 3 Showman13 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 27 sec
Reputation Power: 0
Clearly, it is unclear to me

Quote:
Originally Posted by Showman13
Yes, that was basically my question, and the answer I was hoping for.. Now I will take the time to see how I can implement it in my program.

Thanks



OK, after uploading and testing the pdf_label.php and the labelTest.php, I find that I don't really know what I'm looking at, or doing...

My thought was that I could upload those two files and then go to the labelTest.php and it would display on the screen the test page of labels, but that didn't happen..

All I get is a blank page...

I know I'm missing something and it will most likely be very simple, Just not seeing what it is at this point.

In looking over this code in pdf_label, I don't see where some of the variable assignments come from

PHP Code:
 $_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
$this->SetXY($_PosX$_PosY);
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$texte0'L'); 


Part of the problem is trying to understand something that I have never worked with before, using the ($this->) has never been a part of my programming experience.

Any help or direction that you could provide would be greatly appreciated.

Thanks
Douglas

Reply With Quote
  #12  
Old January 19th, 2012, 09:35 AM
SecurityDavid SecurityDavid is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 170 SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level)SecurityDavid User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 2 h 34 m 47 sec
Reputation Power: 53
Quote:
Originally Posted by Showman13
OK, after uploading and testing the pdf_label.php and the labelTest.php, I find that I don't really know what I'm looking at, or doing...
Just so there is not any misunderstanding of what we're doing here, the script above is based on FPDF from here with an add-on from here . This is a customization, not a stand alone script. Please review the documentation on each of these links. Then if you run into problems implementing it, please post your specific issue in a new thread.

Reply With Quote
  #13  
Old December 31st, 2012, 07:31 PM
KennyB2550 KennyB2550 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 KennyB2550 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 12 sec
Reputation Power: 0
Did you ever find a solution to producing 5160 pdf labels?
I too am looking to do this


Quote:
Originally Posted by Showman13
OK, after uploading and testing the pdf_label.php and the labelTest.php, I find that I don't really know what I'm looking at, or doing...

My thought was that I could upload those two files and then go to the labelTest.php and it would display on the screen the test page of labels, but that didn't happen..

All I get is a blank page...

I know I'm missing something and it will most likely be very simple, Just not seeing what it is at this point.

In looking over this code in pdf_label, I don't see where some of the variable assignments come from

PHP Code:
 $_PosY $this->_Margin_Top $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
$_PosX $this->_Margin_Left $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
$this->SetXY($_PosX$_PosY);
$this->MultiCell($this->_Width $this->_Padding$this->_Line_Height$texte0'L'); 


Part of the problem is trying to understand something that I have never worked with before, using the ($this->) has never been a part of my programming experience.

Any help or direction that you could provide would be greatly appreciated.

Thanks
Douglas

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Labels,Pdf,fpdf

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap