![]() |
Language Reference » Barcode 128 functions » pBarcode128
|
|
Latest updates
Toolbox
Google AdSense
|
pBarcode128 - Draw a code 128 barcode This function allows you to embed a code 128 barcode on your pictures. Code 128 is a very high density alphanumeric bar code. The symbol can be as long as necessary to store the encoded data. It is designed to encode all 128 ASCII characters, and will use the least amount of space for data of 6 characters or more of any 1-D symbology. Each data character encoded in a Code 128 symbol is made up of 11 black or white modules. The stop character, however, is made up of 13 modules. Three bars and three spaces are formed out of these 11 modules. Bar and spaces can vary between 1 and 4 modules wide. The symbol includes a quiet zone (10 x-dimensions), a start character, the encoded data, a check character, the stop character, and a trailing quiet zone (10 x-dimensions). For optimum hand-scanning with a contact reader, the quiet zone should be at least 0.25 inches. Calling this function
pBarcode128($BasePath=""); $BasePath specify the top level path where the data folder stands. Sample script ![]() /* pChart library inclusions */ include("class/pDraw.class.php"); include("class/pBarcode128.class.php"); include("class/pImage.class.php"); /* Create the pChart object */ $myPicture = new pImage(700,230); /* Draw the background */ $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107); $myPicture->drawFilledRectangle(0,0,700,230,$Settings); /* Overlay with a gradient */ $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50); $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings); $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80)); /* Draw the top bar */ $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0, "EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100)); $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); $myPicture->setFontProperties(array("FontName"=>"fonts/Silkscreen.ttf","FontSize"=>6)); $myPicture->drawText(10,13,"Barcode 128 - Add barcode to your pictures",array("R"=>255,"G"=>255,"B"=>255)); /* Create the barcode 128 object */ $Barcode = new pBarcode128(); /* Draw a simple barcode */ $myPicture->setFontProperties(array("FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6)); $Settings = array("ShowLegend"=>TRUE,"DrawArea"=>TRUE); $Barcode->draw($myPicture,"pChart Rocks!",50,50,$Settings); /* Draw a rotated barcode */ $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>12)); $Settings = array("ShowLegend"=>TRUE,"DrawArea"=>TRUE,"Angle"=>90); $Barcode->draw($myPicture,"Turn me on",650,50,$Settings); /* Draw a rotated barcode */ $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>12)); $Settings = array("R"=>255,"G"=>255,"B"=>255,"AreaR"=>150,"AreaG"=>30,"AreaB"=>27,"ShowLegend"=>TRUE,"DrawArea"=>TRUE, "Angle"=>350,"AreaBorderR"=>70,"AreaBorderG"=>20,"AreaBorderB"=>20); $Barcode->draw($myPicture,"Do what you want !",290,140,$Settings); /* Render the picture */ $myPicture->Render("drawbarcode.png"); This will draw three barcodes.
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has
been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 415 users have registered.
This page has been rendered in 0,02 seconds. Wiki revision 1.37.
|