Pro-Barcode Software Logo
flag german flag uk flag us Tip: Bookmark this page with Ctrl-D (Win) or Apple-D (Mac) MainProductsKnow How / FAQDownloadStoreContact

Manual - Macintosh Dynamic Library Code 128 / 128 GS1 - Reference

Properties

For each property, a set / get accessor method pair is available, see the supplied WSDY1.h file for a list.

Naming conventions: All accessor method names start with WSDY1, followed by set or get, then followed by the property name in camel casing. E.g. the property dataToEncode has the accessor methods WSDY1setDataToEncode() and WSDY1getDataToEncode().

Name Type Comment
dataToEncode char * Data to encode in the barcode. String can have up to 128 characters (the practical limit for Code 128 is 40, though).

With gs1 set to true: ASCII data only.

With gs1 set to false: To encode non-printable charaters, e.g. a TAB, use the tilde, followed by the ASCII code, left padded with "0" to three digits. E.g. to encode a TAB, write "~009". To encode an FNC1 character (if you want to assemble your own Code 128 GS1 symbols), write "~999". To encode a tilde, write "~0126".

Note: When encoding non-printable characters make sure your scanner can actually read and transmit such data - this is not a given, especially if the scanner emulates a keyboard, e.g. via a wedge or USB.

Default: "Code 128"
 
moduleWidth float Width of the smallest bar (= module) in mm.

The smallest acceptable value depends on the print resolution, for Code 128 GS1 the value should be between 0.495 and 1.016 mm.

Default: 0.5 mm
 
moduleHeight float Height of the barcode in mm.

The smallest acceptable value depends on the application, values under 8 mm should be avoided, for Code 128 GS1 the value should be 32 mm.

Default: 25 mm
 
gs1 Boolean False: create a normal Code 128. True: Create a Code 128 GS1

Barcodewise, both code types differ as follows:

a. With Code 128 GS1, an FNC1 character is put after the start symbol.

b. With Code 128 GS1, application identifiers in parentheses are evaluated. This has two effects: Firstly, the parentheses are stripped from the encoded data (removing them from the barcode, but retaining them for the human readable text, in accordance with the standard), secondly, variable fields are terminated with an FNC1.

All this happens behind the stage; besides setting the gs1 flag to true nothing else has to be done.

Note, however, that you have to provide to the library a correctly formatted string, including all application identifiers and parentheses, e.g. to create a barcode for an SSCC18 you'll have to set the dataToEncode property to a string like this: "(00)340123451234567895". Please refer to the respective GS1 specifications.

Default: false
 
humanReadable Boolean Display human readable text under the barcode.

Default: true
 
humanReadableFont char * Name of the font to use for the human readable text.

Default: "Arial"
 
humanReadableSize float Size of the font for the human readable text in points.

Default: 12 pt.
 
marginX float Left and right margin of the barcode. Should not be under 5 mm.

Default: 5 mm.
 
marginY float Top and bottom margin of the barcode. Should not be under 5 mm.

Default: 5 mm.
 

Methods

Name Parameter Comment
WSDY1createCode float dpi Creates a barcode, returns a CGImageRef with the code. The dpi parameter determines the output resolution, e.g. 300 for 300 dpi. The actual dimensions of the barcode (and, hence, the returned bitmap) are determined from the moduleHeight, moduleWidth and the encoded data. The samples provide helper functions to save the CGImageRef to a file or to convert it to an NSImage.

Returns: CGImageRef
 
WSDY1bitpattern_c128 char *data Creates the actual bitpattern of a Code 128 barcode in form of an array. Bars are set to '1' in the array, spaces are set to '0'. Will also perform the tilde-substitution as described above. See the description of the samples for an example.

Returns: char * - Note: Returns NULL when in demo mode.
 
WSDY1bitpattern_c128gs1 char *data Creates the actual bitpattern of a Code 128 GS1 barcode in form of an array. Bars are set to '1' in the array, spaces are set to '0'. Will also perform the parentheses-evaluation as described above.

Returns: char * - Note: Returns NULL when in demo mode.
 
WSDY1resetToDefaults void Resets all properties to the defaults as described in this document.

Returns: void
 
WSDY1unlock char *user
char *key
Unlock the library and remove the restrictions of the demo. See the supplied sample projects for an example.

Returns: Boolean - True: Successfully unlocked; False: Error.