Skip to content

Instantly share code, notes, and snippets.

@thefrosty
Created September 11, 2012 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefrosty/3701418 to your computer and use it in GitHub Desktop.
Save thefrosty/3701418 to your computer and use it in GitHub Desktop.
Set badge location.
<?php
// http://www.avery.com/avery/en_us/Products/Name-Badges/Name-Badges/Insertable-Name-Badges_74459.htm (3" X 4")
// Add a page, but only on a multiple of 6
if ( $counter == 1 || ( $counter % 7 == 0 ) ) {
$pdf->AddPage('P', 'Letter');
$counter = 1;
}
// Set the co-ordinates for all items in each of the badges
switch ( $counter ) {
//Width: 101.6 - Height: 76.2
case 1:
$background_x = 6.1;
$background_y = 25;
$avatar_x = 15;
$avatar_y = 51;
$text_x = 18;
$text_y = 96;
break;
case 2:
$background_x = 108.1;
$background_y = 25;
$avatar_x = 118.1;
$avatar_y = 51;
$text_x = 119.6;
$text_y = 96;
break;
case 3:
$background_x = 6.1;
$background_y = 101.6;
$avatar_x = 15;
$avatar_y = 128;
$text_x = 18;
$text_y = 172;
break;
case 4:
$background_x = 108.1;
$background_y = 101.6;
$avatar_x = 118.1;
$avatar_y = 128;
$text_x = 119.6;
$text_y = 172;
break;
case 5:
$background_x = 6.1;
$background_y = 178.2;
$avatar_x = 15;
$avatar_y = 205;
$text_x = 18;
$text_y = 250;
break;
case 6:
$background_x = 108.1;
$background_y = 178.2;
$avatar_x = 118.1;
$avatar_y = 205;
$text_x = 119.6;
$text_y = 250;
break;
}
?>
@thefrosty
Copy link
Author

Just figured out that my badges are printing 7 per page. Somehow number 7 is being added on top of number 6. Does any of this code say that?

@trepmal
Copy link

trepmal commented Sep 11, 2012

I'd guess $counter % 7 == 1 would be causing the trouble. I'd try $counter % 6 == 0

@thefrosty
Copy link
Author

Thanks. That didn't fix it, but $couter % 7 == 0 did!

@thefrosty
Copy link
Author

Now since that caused an issue I need to output every 6th attendee.

for ( $i = 0; $i < count($attendee); $i++ ) {
}

@thefrosty
Copy link
Author

Never mind that crap, going to just comment out attendee's array every 6th one and reprint those old ones.

@sdenike
Copy link

sdenike commented Sep 11, 2012

I can look to see if I have the badge code I modified for last years WCLV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment