-   Tools Development (
-   -   Barcode in PDF (

lotius81 25th August 2017 23:16

Barcode in PDF
Trying to get barcodes working in PDF. We use Code39 barcodes in our plant.

In report script I have these lines..

domain tcmcs.str20 prod.barcode

prod.barcode = bc$(9,3,strip$(shiftl$(tisfc001.pdno)), 0x000c80)

Attempting to print prod.barcode results. All I get is some garble like the following:


I've tried changing the barcode value in the field options to 1, etc. Still can't figure out what I'm doing wrong :( Or if this is too vague I'm happy to provide more info..


bdittmar 26th August 2017 09:31


function string bc$  (long type, long rows, string barcode, long options)

Use this to create a barcode of the specified type.


long type barcode type, a number in the range 1-1000 for a 1D-barcode and 1001-2000 for a 2D-barcode.
long rows The height of the barcode, as a number of lines.
string barcode The string or data that must be converted to a barcode.
long options Options for the barcode, see below

This function can be used in all script types.

Options for barcodes

1D-Barcode option Description
BC_AUTOPARITY calculate parity
BC_TRANSPARENTBACKGRND transparent background
BC_SHOWLIGHTMARGINS show light margins
BC_SHOWBEARERS show bearer bars
BC_EXTENDBEARERS extend bearer bar into light margin
BC_SHOWTEXT show barcode caption text
BC_CALCCHECKSUM calculate checksum
BC_SHOWCHKDIGIT show checksum digit
BC_FIXEDXUNIT use fixed xunits for barcode width
BC_EXTRA_FLAG1 barcode specific extra1 flag
BC_EXTRA_FLAG2 barcode specific extra2 flag
2D-Barcode option Description
BC2D_TRANSPARENTBACKGRND transparent background
BC2D_AZTECMENU Aztec menu option
BC2D_AZTECRVIDEO Aztec reverse video
BC2D_DATAMATRIXGS1 Datamatrix GS1 encoding
BC2D_PDF417TRUNCATE PDF417 truncate
BC2D_SET_MODE(m) mode, valid range: 0x0 - 0xF
BC2D_SET_LEVEL(l) security level, valid range: 0x00 - 0x3F
BC2D_SET_XUNIT(x) set x-unit, valid range: 0x00 - 0xFF
BC2D_SET_MULYUNIT(m) set y-unit multiplier, valid range: 0x0 - 0xF
BC2D_SET_COLUMNS(c) set columns, valid range: 0x0 - 0xF
Multiple options can be combined with bit.or function or with + operator (e.g. if more than 2 options need to be combined). Note that not all options are applicable to all barcodes.

Deprecated variants

string bc$( long type, long rows, string barcode )

string bc$( long type, long rows, string barcode, [long calc_checksum, long show_checkdigits] )


The calc_checksum, show_checkdigits and options arguments are not used on non-Windows platforms.
The 3-argument variant of bc$() has a limitation to the barcode type, which need to be in range of 1-31.
The 3- and 5-argument variant of bc$() has a limitation to the barcode string of 224 bytes.
2D-barcodes are supported on Windows platform only, by BWPrint, starting with portingset 6.1c.09 (BW=B40c.95), 8.5a.02 and 8.5b.
Starting with these BWprint versions: a barcode.pdf file is supplied in the directory where BWprint is installed. This pdf contains information about the capabilities and allowed options for barcodes.
1D-barcode options and 2D-barcode options cannot be mixed and will result in unspecified behavior.
Windows platform/BwPrint
The barcode type points to a barcode type. Check the barcode-1D and/or barcode-2D test in the Help menu of BwPrint for available barcode types. The number of available barcode types depend on the thirdparty software from dlSoft. This software is used to generate the barcode images.

Non-Windows platforms
The barcode type points to a shell script that is used to generate the barcode. This script is printer and customer specific. The script is stored in the $BSE/lib/barcode directory. The script name has the form 'type xx ', where xx gets a leading zero for a barcode type with a value lower than 10. For example 'type02' or 'type100'. The script is called by the printer daemon/filter in the form (quotes are added, to surround the barcode caption): $BSE/lib/barcode/type type 'barcode 'rows.


print bc$( 2, 3, "87291803", bit.or( BC_TRANSPARENTBACKGRND,BC_SHOWTEXT) )

Also have a look at :
and search the forum with >>BARCODE<<, you#ll get a lot of hints !


lotius81 28th August 2017 16:11

Perusing the threads I haven't been able to figure it out still.

I've looked through the barcodes.pdf from dLSoft, PDF-Bar-Codes-Guide.txt, read the entire suggested thread (and multiple others) and was pretty hopefully in that thread that you gave me that bumbaermail's workaround would do the trick. Still nothing. I have my value, a production order number, and it only turns into a long what looks like a hashed value of characters preceded by "base64!".

I went directly into bwprint on the application server and looked at the example options given for a Code 39 type barcode. Tried several variations of bit.or() flags on the bc$() function. Tried setting my field in the layout to with the various barcode options. Barcode=0, barcode=1, barcode=1 and checksum.

I'm just stumped :(

BaanInOhio 30th August 2017 20:31

Try printing to the windows printer, check 'preview'. If the barcode shows up in the preview display, it's probably an issue with the conversion from bwprint to PDF.

Also ensure that the text field where your barcode data is stored has enough room for prefix and suffix control characters. Start with something like 40 characters for a 9 character order number then reduce size until you no longer get an acceptable barcode.

If the barcode doesn't work in windows printer/preview, you should check the 'type09' file in your $BSE/lib/barcode/<device> folder. This is the file that appends the prefix and suffix control characters into the string sent to bwprint/printer.

lotius81 11th September 2017 16:06

I wanted to update this. After speaking with Infor we updated our tools to the latest patch versions and updated our porting set to 9.1a (although Infor recommends 9.1c).

After doing this I was able to get bar codes printing in PDFs.

Report Script for this looks like this:


      extern domain        tcmcs.str50m        prod.barcode

      prod.barcode = trim$(tisfc001.pdno)

Then directly in the prod.barcode's print expression, not in report script, I used the following:


and obviously set the domain to tc mcs.str50m.

Most importantly, I did not set the "bar code" value to 1 in the report field's layout, I left it as 0. This got my bar code to print to page.

Hopefully this helps someone else!


All times are GMT +2. The time now is 10:00.

©2001-2018 - -