PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • UPC and EAN bar codes: Size of bar codes
  • Size of bar codes
  • Printing a DataMatrix or PDF417 bar code
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Prints a bar code (inside a rectangle).
Note: The print is sent to the printer spooler. To actually print the page, use iEndPrinting.
Versions 18 and later
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the Linux sites.
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 18
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the Linux sites.
iPhone/iPad This function is now available for the iPhone/iPad applications.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the Linux sites.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Print bar codes
// Interleaved 2 of 5 bar code
iPrintBarCode("12345678905", BC_INTER2OF5, 10, 10, 23, 50)
// UPCA bar code
iPrintBarCode("12345678905+22", BC_UPCA, 10, 10, 23, 50)
Versions 16 and later
MyQRCode is BarCodes
MyQRCode..Content = "http://www.windev.com"
MyQRCode..TypeContent = bcTypeURL
MyQRCode..TypeBarCode = BC_QRCODE
iPrintBarCode(MyQRCode, 10, 20, 50, 60)
New in version 16
MyQRCode is BarCodes
MyQRCode..Content = "http://www.windev.com"
MyQRCode..TypeContent = bcTypeURL
MyQRCode..TypeBarCode = BC_QRCODE
iPrintBarCode(MyQRCode, 10, 20, 50, 60)
MyQRCode is BarCodes
MyQRCode..Content = "http://www.windev.com"
MyQRCode..TypeContent = bcTypeURL
MyQRCode..TypeBarCode = BC_QRCODE
iPrintBarCode(MyQRCode, 10, 20, 50, 60)
Versions 16 and later
iPreview()
MyCode is BarCodes
MyCode..Content = "1234567"
MyCode..TypeBarCode = BC_EAN8
MyCode..Options = BC_Left + BC_NoText
iBorder(10, 20, 100, 60)
iPrintBarCode(MyCode, 10, 20, 100, 60)

iEndPrinting()
New in version 16
iPreview()
MyCode is BarCodes
MyCode..Content = "1234567"
MyCode..TypeBarCode = BC_EAN8
MyCode..Options = BC_Left + BC_NoText
iBorder(10, 20, 100, 60)
iPrintBarCode(MyCode, 10, 20, 100, 60)

iEndPrinting()
iPreview()
MyCode is BarCodes
MyCode..Content = "1234567"
MyCode..TypeBarCode = BC_EAN8
MyCode..Options = BC_Left + BC_NoText
iBorder(10, 20, 100, 60)
iPrintBarCode(MyCode, 10, 20, 100, 60)

iEndPrinting()
Syntax

Printing a bar code Hide the details

iPrintBarCode(<Value of Bar Code> , <Type> , <X1> , <Y1> , <X2> , <Y2> [, <Extended Code>])
<Value of Bar Code>: Character string (with quotes)
Character string that will be represented as a bar code.
<Type>: Integer constant
Type of bar code to represent (the different types of bar codes supported by WINDEV are presented in Managing the bar codes).
Versions 21 and later
BC_AZTEC
New in version 21
BC_AZTEC
BC_AZTEC
Aztec bar code.
BC_CODE128Code128 bar code.
BC_CODE39Code39 bar code.Bar code usable with <Extended Code> corresponding to BC_Extended or BC_Check
The value of the bar code can contain the start and end characters ("*" character). In this case, these characters will be added to the drawing of the bar code and will be printed in the text displayed below the bar code.
If these characters are not found in the value of bar code, they will be automatically added to the drawing of bar code.
However, they will not be printed in the text displayed below the bar code.
BC_CODE93Code93 bar code.Bar code usable with <Extended Code> corresponding to BC_Extended or BC_Check).
BC_CODE11Code11 bar code.
BC_INTER2OF5Interleaved 2 of 5 bar code.Bar code usable with <Extended Code> corresponding to BC_Check.
BC_CODABARCodabar bar code.Bar code usable with <Extended Code> corresponding to BC_Check.
BC_DATAMATRIXData Matrix bar code.
BC_EAN128EAN-128 bar code.
BC_EAN13EAN-13 bar code.Possible values for the bar code:
12 characters,
12 characters + 2 additional characters ("012345678912+22" for example)
12 characters + 5 additional characters ("012345678912+22335" for example)
A control character is automatically inserted after the 12th character.
BC_EAN8EAN-8 bar code.Possible values for the bar code:
7 characters,
7 characters + 2 additional characters ("0123456+22" for example)
12 characters + 5 additional characters ("012345678912+22335" for example)
A control character is automatically inserted after the 7th character.
Versions 18 and later
CB_GS1_128
New in version 18
CB_GS1_128
CB_GS1_128
GS1-128 bar code (new name for the EAN-128 bar code).
Versions 21 and later
BC_MAXICODE
New in version 21
BC_MAXICODE
BC_MAXICODE
MaxiCode bar code.
BC_MSIMSI bar code.
BC_PDF417PDF417 bar code.
BC_UPCAUPC-A bar code.Possible values for the bar code:
11 characters,
11 characters + 2 additional characters ("01234567891+22" for example)
11 characters + 5 additional characters ("01234567891+22335" for example)
A control character is automatically inserted after the 11th character.
BC_UPCEUPC-E bar code.Possible values for the bar code:
11 characters,
11 characters + 2 additional characters ("01234567891+22" for example)
11 characters + 5 additional characters ("01234567891+22335" for example)
A control character is automatically inserted after the 11th character.
<X1>: Real
Horizontal coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y1>: Real
Vertical coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
<X2>: Real
Horizontal coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y2>: Real
Vertical coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
<Extended Code>: Optional Integer constant (or combination of constants)
Characteristics of bar code.
BC_BottomBar code located at the bottom of destination rectangle.
Affected bar codes: all
BC_ControlDigitsBar codes containing control characters. By default, the control characters are enclosed between the "<" and ">" characters. In order for these characters not to be interpreted as control characters, they must be doubled.
See The different types of bar codes for more details.
Affected bar codes: BC_CODE128, BC_DATAMATRIX, BC_EAN128, BC_GS1_128 and BC_PDF417 bar codes.
BC_CheckDigitsBar codes containing check characters.
If this option is selected, the BC_ControlDigits and BC_Charsets constants are automatically taken into account.
Affected bar codes: BC_CODE128, BC_DATAMATRIX, BC_EAN128, BC_GS1_128 and BC_PDF417 bar codes.
BC_CenterHBar code centered horizontally in the destination rectangle.
Affected bar codes: all
BC_CenterVBar code centered vertically in the destination rectangle.
Affected bar codes: all
BC_RightBar code aligned to right in the destination rectangle.
Affected bar codes: all
BC_ExtendedExtended bar code.
Affected bar codes: BC_CODE39 and BC_CODE93 bar codes.
Versions 18 and later
BC_FormatText
New in version 18
BC_FormatText
BC_FormatText
Formats the text displayed: brackets are added around AIs in the printed text.
Affected bar codes: EAN 128 or GS1-128 bar codes.
BC_LeftBar code aligned to left in the destination rectangle.
Affected bar codes: all
BC_TopBar code located at the top of destination rectangle.
Affected bar codes: all
BC_IgnoreFormattingIgnores the brackets found in a 128, EAN-128 or GS1-128 bar code.
The brackets allow the users to easily read the bar code but they are not drawn in the code.
Affected bar codes: CB_CODE128, CB_EAN128 and CB_GS1_128 bar codes.
BC_CharsetsBar code using one or more sets of characters in order to compress the bar code. This set of characters must be defined in the value of bar code.
See The different types of bar codes for more details.
Affected bar codes: all
BC_NotProportionalAdjusts the bar code to the size of destination rectangle.
Affected bar codes: all
BC_NoTextDisplays no text below the bar code.
Affected bar codes: BC_UPCA, Bc_UPCB, BC_EAN13 and BC_EAN8 bar codes.
BC_TextDisplays the text below the bar code.
The text is normalized for the BC_UPCA, BC_UPCE, BC_EAN13 and BC_EAN8 bar codes.
For the other types of bar codes, the text can exceed the display border of bar code.
Affected bar codes: all
BC_CheckBar code with check characters.
Affected bar codes: BC_CODE39, BC_CODE93, BC_INTER2OF5 and BC_CODABAR bar codes.
BC_VerticalPrints the bar code vertically.
Affected bar codes: all
BC_90Prints the bar code vertically.
Affected bar codes: all
BC_180Prints the bar code while performing a rotation equal to 180 degrees.
Affected bar codes: all
BC_270Prints the bar code while performing a rotation equal to 270 degrees.
Affected bar codes: all
Versions 16 and later

Printing a bar code (BarCode variable) Hide the details

iPrintBarCode(<Bar code> , <X1> , <Y1> , <X2> , <Y2>)
<Bar code>: BarCodes variable
Name of the BarCodes variable containing the description of the bar code to print.
<X1>: Real
Horizontal coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y1>: Real
Vertical coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
<X2>: Real
Horizontal coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y2>: Real
Vertical coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
New in version 16

Printing a bar code (BarCode variable) Hide the details

iPrintBarCode(<Bar code> , <X1> , <Y1> , <X2> , <Y2>)
<Bar code>: BarCodes variable
Name of the BarCodes variable containing the description of the bar code to print.
<X1>: Real
Horizontal coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y1>: Real
Vertical coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
<X2>: Real
Horizontal coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y2>: Real
Vertical coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).

Printing a bar code (BarCode variable) Hide the details

iPrintBarCode(<Bar code> , <X1> , <Y1> , <X2> , <Y2>)
<Bar code>: BarCodes variable
Name of the BarCodes variable containing the description of the bar code to print.
<X1>: Real
Horizontal coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y1>: Real
Vertical coordinate of top left corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
<X2>: Real
Horizontal coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page width (returned by iPageWidth).
<Y2>: Real
Vertical coordinate of bottom right corner of the rectangle where the bar code will be drawn (in millimeters).
Value included between 0 and the page height (returned by iPageHeight).
Remarks

UPC and EAN bar codes: Size of bar codes

The standard for the UPC and EAN codes defines the proportion between the height and width of the bar codes. The drawings of these bar codes respect this standard by default. However, the BC_NotProportional constant allows you to draw "non-standard" bar codes.
Note: The space used to draw the bar code cannot be occupied at 100%. Indeed, the size of each bar is calculated so that a bar code can always be read.

Size of bar codes

The actual size of the drawing of a bar code may be less than the specified width.
Indeed, the width of each bar is calculated from the with of the narrowest bar found in the bar code. The width of each bar must be a whole number of pixels.
Example for calculating the width of a bar code:
  • The drawing must be 130-pixel wide.
  • The drawing contains 10 narrow bars of width 1 and 5 large bars of width 2.
  • Calculating the width of a narrow bar = 110 / (10 + 5*2) = 5 pixels
  • Calculating the total width for the drawing = 5 * (10 + 5*2) = 100 pixels
Once the BC_CenterH constant has been used, the drawing will start at (110-100) /2 = 5 pixels from the left border and it will end at 5 pixels from the right border.

Printing a DataMatrix or PDF417 bar code

The following options are taken into account when a DataMatrix or PDF417 bar code is printed by iPrintBarCode:
Data Matrix
  • Size of the matrix calculated according to the length of the string and optimized to get a squared matrix.
  • Set of characters: WINDEV optimizes the choice of character sets in order to write the bar code with the smallest possible characters.
PDF417
  • Size of the matrix calculated according to the string
  • Level of correction calculated according to the length (after compression) of the data to encode:
    • from 1 to 40 characters: level 2
    • from 41 to 160 characters: level 3
    • from 161 to 320 characters: level 4
    • from 321 characters: level 5
  • Line height: 4
  • Set of characters: WINDEV optimizes the choice of character sets in order to write the bar code with the smallest possible characters.
See The different types of bar codes for more details.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230prn.dll
Windows Mobile wp230prn.dll
Linux wd230prn.so
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment