//
you're reading...
IT-Center, PHP, Web Based

Barcode Render using PHP

Hiiiii dear all, i will present easy sample barcode with phpcode, and you can download this example by zip file.

<?php
require_once ('core.php');

$start = 1;
$max = 150;
$sn = 501;
$imei =1;
for($i=$start;$i<=$max;$i++){
     $imei_string = '';
     $sn_string = '';
     $imei_string = "35566103012".sprintf('%03d', $imei);
     $sn_string = "DM-V110015".sprintf('%03d', $sn);

$p_bcType=1;
$p_textEnc=rawurlencode($imei_string);
$p_xDim=1;
$p_w2n=2;
$p_charGap=1;
$p_invert='N';
$p_charHeight=15;
$p_type=1;
$p_label='N';
$p_rotAngle=0;
$p_checkDigit='N';
# <img src="{BARCODE_CONOTE}" alt="{P_TEXT}" align="middle">
$dest_imei = "<img src=\"wrapper.php?p_bcType=$p_bcType&p_text=$p_textEnc" .
"&p_xDim=$p_xDim&p_w2n=$p_w2n&p_charGap=$p_charGap&p_invert=$p_invert&p_charHeight=$p_charHeight" .
"&p_type=$p_type&p_label=$p_label&p_rotAngle=$p_rotAngle&p_checkDigit=$p_checkDigit\" alt=\"$imei_string\" align=\"middle\">";

$p_bcType=1;
$p_textEnc=rawurlencode($sn_string);
$p_xDim=1;
$p_w2n=2;
$p_charGap=1;
$p_invert='N';
$p_charHeight=15;
$p_type=1;
$p_label='N';
$p_rotAngle=0;
$p_checkDigit='N';
$dest_sn = "<img src=\"wrapper.php?p_bcType=$p_bcType&p_text=$p_textEnc" .
"&p_xDim=$p_xDim&p_w2n=$p_w2n&p_charGap=$p_charGap&p_invert=$p_invert&p_charHeight=$p_charHeight" .
"&p_type=$p_type&p_label=$p_label&p_rotAngle=$p_rotAngle&p_checkDigit=$p_checkDigit\" alt=\"$imei_string\" align=\"middle\">";

echo "<table>";
echo "<tr><td> <font size='-2'> IMEI</fon> </td> <td> <font size='-2'>".$imei_string."</fon></td></tr>" ;
echo "<tr><td colspan='2'> ".$dest_imei."</td></tr>" ;
echo "<tr><td><font size='-2'> S/N </fon> </td> <td> <font size='-2'>".$sn_string."</fon></td></tr>" ;
echo "<tr><td colspan='2'> ".$dest_sn."</td></tr>" ;

?>
<tr>
<td colspan="2" align="center">

<table width="80%" border="1" bordercolor="#000000" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" align="center"> <font size="-2">18446</font></td> <td align="center"> <font size="-2">Postel</font></td>
</tr>
<tr>
<td align="center"> <font size="-2">SDPPI</font></td> <td align="center"> <font size="-2">2011</font></td>
</tr>
</table>

</td>
</tr>

    <?php
    echo "</table> <br><br>";
    $imei++;
    $sn++;

}

?>

You can save that file using index.php. Before you need file at folder barcode,wrapper.php,defs.inc.
This function needed php library  gd2.dll, you can activate this library at php.ini uncomment php_gd2.dll

You can download this sample at here

About berbagisolusi

Berbagi merupakan sebuah bentuk simbol keikhlasan untuk membantu dan menolong, sedangkan solusi adalah cara menyelesaikan masalah. Setiap manusia pasti mengalami masalah, tetapi kita tidak perlu mengalami masalah yang sama jika orang lain pernah mengalami dan kita tahu hal tersebut.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 9 other followers

November 2011
M T W T F S S
    Dec »
 123456
78910111213
14151617181920
21222324252627
282930  

Archives

Web Statistic

Blog Stats

  • 149,580 hits
%d bloggers like this: