Advertising sustains the DA. Ads are hidden for members. Join today

On this page

Advanced Example

Last updated on
30 April 2025

This example is to be used with the attached sample JPEG.

Step 1

Create a new badge and set the following
page orientation = Portrait
Page Style = Image (Width/Height are ignored when page style is set to image)

Step 2

Upload the attached sample JPEG to the newly created badge

Step 3

Copy/paste the following code into the PHP section of the badge.

//print horizontal first name
$pdf->SetFont('freemono', '', 60);
$pdf->setxy(52,178);
$pdf->SetTextColor(100,100,100);
$pdf->Cell(10,40,strtoupper($account->profile_firstname),0,0,"left",0,0);

//print horizontal last name
$pdf->SetFont('freemono', '', 65);
$pdf->setxy(52,192);
$pdf->SetTextColor(255,0,0);
$pdf->Cell(10,40,strtoupper($account->profile_lastname),0,0,"left",0,0);

//Print expirydate exactly one year from date printed.
$pdf->SetFont('freemono', 'b', 20);
$pdf->setxy(79,202);
$pdf->SetTextColor(0,0,0);
$expirydate = date('n/j/Y', mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1));
$pdf->Cell(10,40,$expirydate,0,0,"left",0,0);

//Print vertical firstname
$pdf->SetFont('freemono', '', 40);
$pdf->Rotate(-90, 270, 0);
$pdf->setxy(321,9);
$pdf->SetTextColor(100,100,100);
$pdf->Write(10,strtoupper($account->profile_firstname), NULL, 0);

//Print vertical lastname
$pdf->SetTextColor(240,0,0);
$pdf->SetFont('freemono', '', 45);
$pdf->Write(10,strtoupper($account->profile_lastname), NULL, 0);

Help improve this page

Page status: Not set

You can: