Login Register Wishes Forum About
Language Reference » Barcode 39 functions » getSize
Help topics
Latest updates
4693d  replaceImageMapTitle
4693d  replaceImageMapValues
4693d  createFunctionSerie
4693d  setAbsicssaPosition
4693d  negateValues
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
getSize - Return the projected size of a code 39 barcode

This function allows you to estimate the target size of a code 39 barcode. You‘ll have to give it the same $Format array than the one you‘ll use when calling the draw method in order to have an accurate projection of the barcode size.

This function is particulary useful when you want to create a picture containing only a barcode (to embed it in a more complex document like PDF file).

If you plan to display the barcode legend in plain text (ShowLegend parameter), you‘ll need to specify the font height manually (FontSize parameter) as when you‘ll call this function the pChart object will not be instantiated yet.

Calling this function
Where :

$TextString is the text to be encoded.
Format is an array containing the drawing parameters of the pixel.

Customisation array - Tune up your barcode!

It is possible to customize the barcode rendering by playing with this array. Providing a detailled configuration is not mandatory, by default the barcode will be drawn black with no transparency, no border and no subtitle.

You can define the barcode height with Height. (default is 30)
You can define the barcode angle with Angle.
If you want to display the legend in clear text, set ShowLegend to TRUE.
You can define the legend offset with LegendOffset. (default is 5)
You can draw a surrounding area by setting DrawArea to TRUE.
You can specify the font height to use with FontSize.

Sample script

  /* pChart library inclusions */

 /* Create the barcode 39 object */
 $Barcode = new pBarcode39();

 /* String to be written on the barcode */
 $String = "This is a test";

 /* Retrieve the barcode projected size */
 $Settings = array("ShowLegend"=>TRUE,"DrawArea"=>TRUE);
 $Size = $Barcode->getSize($String,$Settings);

 /* Create the pChart object */
 $myPicture = new pImage($Size["Width"],$Size["Height"]);

 /* Render the barcode */

 /* Render the picture */

This will draw a single barcode.
Last updated on 06/07/2010 
by Jean-Damien 
Linked resources
Community comments
  No comments have been posted yet.
© 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,01 seconds. Wiki revision 1.37.