PHP and FPDF - sprintf not working with data in certain combinations -


i'm having problem following code. want use content (taken community builder fields) print labels envelopes.

the first line of label contain subscriber's title, first name , surname, , works fine. pdf required info.

the second line things start go pear-shaped. try include $faculty in line 2 instead of empty string i've got there in code below, pdf produced downloads 0 bytes , acrobat says it's not supported file type.

weird thing can print $faculty onto label if don't include first line.

the code i'm working printed same data csv. need go pdf instead.

anyone know why happening , can point me in right direction? there's commas , stuff in many of fields i'm using wouldn't make difference it?

cheers!

note clarity: code works. doesn't work when replace $linetwo assignment below '$linetwo = sprintf("%s",$faculty);'. or '$linetwo = "$faculty");".

foreach($activesubscribers $subscriber) { $title = $subscriber->$fields[0][1]; $firstname = $subscriber->$fields[1][1]; $surname = $subscriber->$fields[2][1]; $faculty = $subscriber->$fields[3][1];           $institution = $subscriber->$fields[4][1];   $address1 = $subscriber->$fields[5][1];  $address2 = $subscriber->$fields[6][1];  $suburb = $subscriber->$fields[7][1];  $state = $subscriber->$fields[8][1];         $postcode = $subscriber->$fields[9][1];  $country = $subscriber->$fields[10][1];   $lineone = sprintf("%s %s %s",$title, $firstname, $surname);  $linetwo = "";              // should have faculty , institution $linethree = sprintf("%s",$suburb); // should have address line 1  $linefour = "";             // should have address line 2 $linefive = "";             // should have suburb, state, postcode $linesix = "";              // should have country  

i think forget add line

$text = sprintf("%s\n%s\n%s\n%s", $lineone, $linetwo, $linethree, $linefour); $pdf->add_label($text); 

if don't want use sprintf(), can print line line that

$pdf->add_label($lineone); $pdf->add_label($linetwo); 

try option

$pdf->write(0.2,$lineone); $pdf->write(0.2,$linetwo); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -