Acquire a Barcode Font
You may search the internet for the type of barcode font you wish to download. These should be delivered to you as a .ttf (true type font) file. These files can be used on either Linux or Windows. Be careful when downloading things from the internet to ensure that you don't inadvertently install adware/malware. Many companies attempt to lure you into using an installer package to install their font. While there is nothing fundamentally wrong with this, you should always keep a watchful eye out for installers that install more than just the font you desire. Blue Prairie makes no warranties or assurances about the cleanliness of the links below, please proceed with caution. The author prefers sites that simply allow the download the .ttf file or a series of .ttf files in a zip archive.
Barcodes Inc: https://www.barcodesinc.com/free-barcode-font/
Installing Barcode Fonts on your Windows System (most Windows Versions)
- Upload the acquired .ttf file to a directory visible to your Windows PC.
- Select Start, then Settings and click on the Control Panel.
- Select Fonts, then File in the main tool bar, and click on Install New Font.
- Select the folder where the .ttf file was downloaded.
- Select the desired font and click on OK.
- Open an app to see if the Font is now visible. If not, proceed with the next two steps
- Select Start and choose to shut down and restart the computer.
- The font should be active when the computer is restarted.
Installing Barcode Fonts on your Linux System
BP Forms produces a variety of barcodes using the native capabilities of OpenOffice/Libre Office. These products produce most barcodes by the use of specialized barcode fonts. These fonts are not installed with OpenOffice/LibreOffice by default so you must download and install them both on the PC where you intend to perform your form design with OpenOffice/LibreOffice and on the Linux Open Office/Libre Office server that will be rendering your forms (aka: The linux print server). To use specialized fonts such as barcode fonts, you must legally obtain the desired true type or open type font (.ttf) then upload the font to the Linux/OpenOffice server. The installation is straight-forward as defined below:
Prepare a directory
- Login to your Linux/OpenOffice server using ssh.
- cd to /usr/share/fonts
- See if there already exists a directory called truetype
- If not: mkdir truetype
- chmod 755 truetype
Upload the .ttf file to this directory
- Using a a file transfer tool such as ftp, upload the .ttf file to /usr/share/fonts/truetype
Check the permissions
- Using your ssh session, cd to the truetype directory and chmod 644 *
- cd /usr/share/fonts/truetype
Generate the index files
- ttmkfdir > fonts.scale
Verify that the index files were generated
- ls -la
You should now see a listing somewhat like this (this example based on IDAutomation's Barcode Font, your font name may differ):
[root@PT-Dev fonts]# cd truetype
[root@PT-Dev truetype]# ls -la
drwxr-xr-x 2 root root 4096 Jun 20 18:04 .
drwxr-xr-x 31 root root 4096 Jun 20 17:46 ..
-rw-r--r-- 1 root root 171 Jun 20 18:04 fonts.dir
-rw-r--r-- 1 root root 171 Jun 20 18:04 fonts.scale
-rw-r--r-- 1 root root 41732 Jun 20 17:57 IDAutomationHC39M.ttf
Note the size of the fonts.dir and fonts.scale files. These contain a directory listing describing the fonts found in this directory. This is what OpenOffice reads when populating the ‘font’ pull-down within the product and/or to reference a font specified within a document.
You should now be able to call up OpenOffice on the console or via a remote desktop connection and create a new Writer document. Then choose the font pull-down to confirm that your font is indeed visible to OpenOffice
Using the Barcode Font in a Template
Using most types of barcodes is simple in BP Forms. A type of barcode known as "3 of 9" is generally used for most forms-based barcode work. Open Office and Libre Office have add-on font packs available to render document elements as barcodes rather than text. The process of creating a barcode is as simple as:
- Ensure that you have the barcode font installed on your templating editing PC and on your BP Forms open office server (the server that renders the documents).
- Edit the template
- Select a field that you wish to barcode
- Choose font > (barcode font) (example: font>IDAutomationHC39M)
- Adjust the font size and letting to suit
- Save the document template
- Voila, you have barcodes
That's really it. No programming is required. Just select a tag field and choose the barcode font.
Assume we have the following document template. Notice the placeholder tag %invoiceNo% which is selected in the template below:
Making it a Barcode
- Select the tag (see that we have selected %invoiceNo% in the example above).
- Choose Font>IDAutomationHC39M from the menu
- Set the size to suit
Notice in the image below that the tag %invoiceNo% has changed to a barcode and that below the barcode, you can still see the placeholder tag name %invoiceNo%
Because the placeholder tag name is still intact within the document template, it can still serve as a placeholder just like any other placeholder tag. When the template is used to render a document, this placeholder's value will be changed from %invoiceNo% to the actual invoice number. At that time, the barcode will automatically change to represent the invoice number. In this way, you may barcode anything in the form by simply choosing the desired barcode font within the template and applying it to any placeholder tag.
Advisories About Scanning
The barcode font may be scanned using any scanner that recognizes the barcode type (in the example above, this is a 3 of 9 barcode). However, some scanners man be finicky about the size of the barcode and the letting (spacing between the lines of the barcode). It is recommended to print a test sheet of barcodes using sample values and then test these barcodes with your scanner to ensure that it can easily read the barcode. You may determine that there is a minimum size or letting that is required in order to help the scanner more easily read the barcode.
Things to Adjust To Help Your Scanner
To render the most clear barcode, remove all special emphasis properties from the barcoded placeholder tag. These include removal of Bold, Italic, Underscore, etc. from the placeholder tag.
You can adjust the size of the font upward or downward to achieve the best compromise between fitting on the page and making it easy for the scanner to read the barcode
*Encase with Asterisks*
Some scanners prefer for a barcode to start and end with the asterisk character. Consult your scanner documentation to determine if this is true of your specific scanner model. To encase the bacode with asterisks simply edit the template and change the placeholder tag to begin and end with asterisk. For example, instead of using %invoiceNo%, change it to *%invoiceNo%*.
Letting is the spacing between characters (the vertical lines) in the barcode. This can be achieved in OpenOffice / LibreOffice by selecting the placeholder then choosing Format>Character from the menu. The following page will be shown:
Choose the "Position" tab and then adjust the Spacing characteristic. As you adjust the spacing, you will see the resulting effect in the preview window presented in the page. You may need to experiment with a few settings until you observe an improvement in the scanner's ability to read the barcode.