Product Logo

CNS Barcode

Scan and Generate Barcodes

Functions

CNSBC_Generate

NameCNSBC_Generate
Description

This function will take the data you provide it and generate a barcode image in PNG, EPS, or SVG format.

Return TypeContainer
FormatCNSBC_Generate ( Type ; Data ; Format ; DataMode ; Option1 ; Option2 ; Option3 ; Option4 )
Required Parameters
Type

This specifies the type of barcode to generate. Valid values are “Codabar”, “Code39”, “Code39+”, “Code93”, “Code128”, “Databar14”, “Databar14Stacked”, “DataMatrix”, “EAN”, “EAN14”, “EAN18”, “EAN128”, “HIBCDataMatrix”, “Interleaved2of5”, “ISBN”, “USPS OneCode”, “PDF417”, “Postnet”, “QRCode”, “UPCA”, or “UPCE”.

Data

This is the data to encode into the barcode. If you specify a Number field, the plug-in will auto-format it with four decimal places. However, if the fractional part is zero, it will be removed leaving only the whole number. If you need any other formatting for Numbers, you will need to convert it to text within FileMaker before sending to this function. If the barcode supports it, you can encode control characters either directly with \0, \b, \f, \n, \r, \t, \v, \xXX or by using the Unicode “Control Images” [code points 0x2400–0x2421; Char ( 9216 ) - Char ( 9249 ) ]. If the barcode requires Application Identifiers (AI), use square brackets to specify them (.ie [01]01234567890123 ).

Optional Parameters
Format

The output Format of the Barcode Image. Valid values are “PNG” (the default), “EPS”, or “SVG”.

DataMode

The format the data is interpretted as when generating the barcode. Valid values are “Unicode” [the default], “Binary”, or “GS1”.

Option1
  • PDF417 - Amount of check digit information; specify a number between 0 and 8.
  • QRCode - ECC Level; specify 1 for level L (the default), specify 2 for level M, specify 3 for level Q, specify 4 for level H.
  • Aztec Code - ECC Level; specify 1–4.
Option2
  • Code39 - Set to 1 to add a check digit.
  • Code39+ - Set to 1 to add a check digit.
  • PDF417 - Width of the symbol; specify a number between 1 and 30.
  • DataMatrix - The size of the symbol; (<value to specify>=<size of symbol>) 1=10x10; 2=12x12, 3=14x14, 4=16x16, 5=18x18, 6=20x20, 7=22x22, 8=24x24, 9=26x26, 10=32x32, 11=36x36, 12=40x40, 13=44x44, 14=48x48, 15=52x52, 16=64x64, 17=72x72, 18=80x80, 19=88x88, 20=96x96, 21=104x104, 22=120x120, 23=132x132, 24=144x144, 25=8x18, 26=8x32, 27=12x26, 28=12x36, 29=16x36, 30=16x48.
  • QRCode - The size of the symbol; (<value to specify>=<size of symbol>) 1=21x21, 2=25x25, 3=29x29, 4=33x33, 5=37x37, 6=41x41, 7=45x45, 8=49x49, 9=53x53, 10=57x57, 11=61x61, 12=65x65, 13=69x69, 14=73x73, 15=77x77, 16=81x81, 17=85x85, 18=89x89, 19=93x93, 20=97x97, 21=101x101, 22=105x105, 23=109x109, 24=113x113, 25=117x117, 26=121x121, 27=125x125, 28=129x129, 29=133x133, 30=137x137, 31=141x141, 32=145x145, 33=149x149, 34=153x153, 35=157x157, 36=161x161, 37=165x165, 38=169x169, 39=173x173, 40=177x177.
  • Aztec Code - The size of the symbol; (<value to specify>=<size of symbol>; first 4 size are “compact” symbols) 1=15x15, 2=19x19, 3=23x23, 4=27x27, 5=19x19, 6=23x23, 7=27x27, 8=31x31, 9=37x37, 10=41x41, 11=45x45, 12=49x49, 13=53x53, 14=57x57, 15=61x61, 16=67x67, 17=71x71, 18=75x75, 19=79x79, 20=83x83, 21=87x87, 22=91x91, 23=95x95, 24=101x101, 25=105x105, 26=109x109, 27=113x113, 28=117x117, 29=121x121, 30=125x125, 31=131x131, 32=135x135, 33=139x139, 34=143x143, 35=147x147, 36=151x151.
Option3
  • DataMatix - Set to 100 to automatically adjust the size of the symbol, without using rectangular symbols.
Option4

Add one or more of the following extra parameters separated by a semicolon

  • notext=true - hide the human readable text
  • transparentbg=true - for PNG format, make the background color transparent
  • bgcolor=<hex color> - Specify the barcode background color (use HTML color format like D6D6D6)
  • fgcolor=<hex color> - Specify the barcode foreground color (Use HTML color format like FF2600)
Examples
Example 1

This generates a QR Code with an embedded URL to the CNS Plug-ins website.

CNSBC_Generate( "QRCode" ; "http://www.cnsplug-ins.com/" )
Example 2

This generates a UPC A barcode.

CNSBC_Generate( "UPCA" ; "03506152005" )
Example 3

This generates an ISBN barcode in the EPS format (a vector format that can be cleanly resized).

CNSBC_Generate( "ISBN" ; "9781595544346" ; "EPS" )
Example 4

This generates a Code 128 barcode that is red on a silver background.

CNSBC_Generate ( "Code128" ; "Hello World" ; "PNG" ; "" ; "" ; "" ; "" ; "bgcolor=D6D6D6;fgcolor=FF2600" )
Example 5

This generates an EAN128 barcode with the Application Identifiers (AI) 01 and 240. The resulting barcode will have the human readable text: "(01)01234567890123(240)bottle"

CNSBC_Generate( "EAN128" ; "[01]01234567890123[240]bottle" )