Quantcast
Channel: Morovia Knowledge Base
Viewing all 128 articles
Browse latest View live

Tutorial: Use Morovia Fontware Products in PowerBuilder Applications

$
0
0

Tutorial: Use Morovia Fontware Products in PowerBuilder Applications

Editor's note: this article is contributed by Shawn Pleska, a veteran PowerBuilder programmer who can be reached at . We thank Shawn for this excellent contribution. If you'd like to contribute to the tech library, write to .

Introduction

Morovia, through the Morovia font-tools DLL, provides ease-of-integration with Sybase's PowerBuilder development toolset allowing many barcode types to be seamlessly generated from within PowerBuilder-developed applications. The purpose of this document is to create an understanding within the PowerBuilder development community on how to implement the Morovia Fontware products and the code necessary to enable those products within a PowerBuilder development environment.

Morovia enables the generation of variable-height barcodes within applications by providing two key components: (1) a series of true-type fonts that correspond to a specific height and type of barcode and (2) functions that generate a string result set based on a requested barcode value that when assigned to a field with the corresponding font, creates a barcode that matches the type and value requested. This two-step process enables PowerBuilder developers to continue utilizing the power of Sybase's patented data window technology while unleashing the means to imbed barcode values for display and printing within.

This tutorial is broken down into two components. First, steps necessary to enable the Morovia Fontware for development purposes are detailed. Second, steps required for deployment of applications written in PowerBuilder that include Morovia Fontware barcode capabilities are detailed.

Integration and Use of Morovia Fontware for PowerBuilder Development

In order to equip developers with the means to imbed barcode-generation features within an application, follow these few simple steps:

Step 1

Since Morovia Fontware utilizes custom fonts to generate and display barcodes, the first step is to ensure that the required fonts are installed on the computer being used for development. For instance, the fonts available for use to create UPC-A, EAN, and Bookland barcode values include: mrvUEBma, mrvUEBsa, mrvUEBta, mrvUEBxsa, mrvUEBxta. You can check to see if these fonts are already installed by going to the Control Panel and selecting Fonts.

Figure 1. Ref A.

Ref A.

Step 2

If the necessary font files are displayed in the list, skip this step. If they do not display in the list, this step explains how to install them. Note: Depending on the setup of the computer, administrator rights may be required to install fonts. With the correct security settings, installing fonts is a simple process. From within the Control Panel...Fonts screen, click on File and choose the option Install New Font. This will bring up an ADD FONTS explorer-style navigation window from which you can navigate to where the font-files exist on your system or network. Once the true type fonts display in the list, you can highlight the ones you need in the list by holding down the control key and clicking those needed or to select all, click on the select all button. Once the needed fonts are highlighted, click OK to add the fonts to your system. (See Ref. B)

Figure 2. Ref B.

Ref B.

Step 3

Open Windows Explorer and navigate to c:\program files\common files\morovia\moroviaFontTools folder. Once in this directory, search for file mrvFontTools.dll. This file (the Morovia font-tools dll) must exist in the system directory in order to define and call the needed external functions that generate the string value that the fonts interrupt when creating the barcode

Step 4

If the Morovia Font Tools dll (mrvFontTools.dll) already exists, skip this step. If it does not, download the setup for Morovia font-tools from http://www.morovia.com/font/support/download-fonttools.asp and run the setup to install the necessary files on your system. After setup is complete, file mrvFontTools.dll will exist in the c:\program files\common files\morovia\MoroviaFontTools directory. The installer also installs other support tools, such as encoding function source code in C/C++, JavaScript, Pascal languages. You can import the source code files into your project if you are working with these languages. We only need the Font Tools DLLfor our project.

Step 5

With the fonts successfully installed and Morovia font-tools present, you are ready to add the code components that allow PowerBuilder to interface with Morovia's font products. Generating the interface requires that an external function be defined where most appropriate for your application. External functions can be defined locally to an object or globally to the application. Most recommendations encourage limiting use of global definitions in application architecture. If using the PowerBuilder Foundation Class, we recommend considering the application manager (n_cst_appmanager) as the most appropriate place to define the local external function. This makes the function calls available to all client code. Otherwise, creating the local external function can be done in windows and objects as needed. Creating an external function is done by opening the object in which it will be created, going to the Declare Instance Variables tab, then selecting the dropdown that shows Instance Variables and choosing instead Local External Functions (or Global External Functions if you prefer). (see Ref. C)

Figure 3. Ref C.

Ref C.

Step 6

Define the functions to be used from the Morovia font-tools product. Once the external functions are added, save the changes. (see Ref. D). All encoder functions take a string as input and return the barcode string. Note that the function names are case sensitive and must match the ones in the DLL. For more information visit KB#10011.

Some function prototypes are listed below:

Function string UPC_A (ref string lpString) library "MRVFONTTOOLS.DLL"
Function string EAN13(ref string lpString) library "MRVFONTTOOLS.DLL"
Function string Code128C(ref string lpString) library "MRVFONTTOOLS.DLL"

Figure 4. Ref D.

Ref D.

Warning

In PowerBuilder 10 and above, strings are in Unicode and the prototypes must be modified so that conversion between Unicode and narrow strings is performed. You need to append Alias For at each declaration, as illustrated below:

Function string UPC_A (ref string lpString) &
      library "MRVFONTTOOLS.DLL" Alias For "UPC_A;Ansi"
Function string EAN13(ref string lpString) &
      library "MRVFONTTOOLS.DLL" Alias For "EAN13;Ansi"
Function string Code128C(ref string lpString) &
      library "MRVFONTTOOLS.DLL" Alias For "Code128C;Ansi"

Step 7

In order to generate a barcode within a data window, open a data window and identify the fields or fields that will do so. Click on the first field and identify what its current font is defined as. Change the font of the field to be the most appropriate of the Morovia fonts previously installed to the system in step 2. (See Ref. E)

Figure 5. Ref E.

Ref E.

Step 8

Within the code of the object responsible for creating and populating the values to be displayed in the data window, code must now be added that calls the appropriate external function with the barcode value needed. Calling the function returns a string value that should be populated into the field with the barcode font. This string value identifies for the font how the value should be displayed. If done correctly, the barcode in question should display as desired. Ref. F shows our sample window in development with the data window, a button for calculating the barcode, and a string value to the right of the button. Ref. G shows the code that will execute when the button is clicked. A UPC barcode value of 245792150797 will be passed to function UPC_A, the return string value will be captured on return, and the string value returned will be applied to field barcode_upc (defined with the UPC font). Ref. H shows the results of processing while running the window in development, after clicking the Calculate Barcode button.

Figure 6. Ref F.

Ref F.

Figure 7. Ref G.

Ref G.

Figure 8. Ref H.

Ref H.

Step 10

Bask in the glory of having successfully implemented barcode capabilities within your PowerBuilder application made possible thanks to Morovia Fontware products.

Deploying Applications that Use Morovia Fontware Barcode Generation

Redistribution of Morovia Fontware products within PowerBuilder applications requires appropriate licensing from Morovia Corporation. Once proper licensing is obtained, there are additional terms of the licensing that must be met in order to fulfill your legal obligations under the agreement. Meeting the requirements involves registration of the fonts at runtime on the client computer and de-registration of those same fonts upon termination of your application on the client's computer. The following steps detail how these requirements can be met within PowerBuilder.

Step 1

Define two external functions within your application that interface with the windows API and allow fonts to be dynamically registered and de-registered as needed. Ref. I shows these declarations.

Figure 9. Ref I.

Ref I.

Step 2

Define a function within the application that can be called at the time the application runs and at the time that the application is being closed. Ref. J shows an example of such a function along with the code to be used to register and unregister fonts using the Windows API calls previously declared in Step 1 as external functions.

Figure 10. Ref I.

Ref I.

Step 3

Call your function (the one you created that is similar to what was just shown in Ref. J) with a value of TRUE when the application is first run (possibly the open event of your application object or the pfc_open event of n_cst_appmanager if using the PFC) and call your function with a value of FALSE when the application is being closed (possibly the close event of your application object or the pfc_close event of n_cst_appmanager if using the PFC). This will register your fonts temporarily for use within your application at runtime, release the fonts when the application closes, and in so doing fulfill the licensing obligations in place between your company and Morovia.


PRB: You Get Error Message "invalid License To or Registration Code" When installing software

$
0
0

PRB: You Get Error Message "invalid License To or Registration Code" When installing software

SYMPTOM

When installing the full version software, you run into an error message "invalid License To or Registration Code".

MORE INFORMATION

Morovia software require two piece of information to match the ones assigned when you install our software. One is License To, which is usually the name of the licensee, and the another is Registration Code, which is generated from License To field and encodes additional other information.

A typical screen look like below:

A common mistake is to enter Registration Code the same as the one assigned, but put a different value in the License To field. If you encountered this error message, check both fields and make sure that both matches the ones assigned.

The license information can be found in the email that we sent to you. Below shows the portion of an email that has the license information:

If you ordered a CD-ROM, you can also find the license information on the cover of the CD box.

APPLIES TO

  • All Morovia Software, full version

POSTNET Specification

$
0
0

POSTNET Specification

POSTNET (Postal Numeric Encoding Technique) is a barcode symbology used by the United States Postal Service to assist in directing mail. Having your letter printing system POSTNET capable enables you to receive a discount on the postage.

The US delivery address coding can be of three forms (1) 5-digit ZIP; (2) 5-digit ZIP + 4 code (3) 11-digit delivery point code. A valid POSTNET barcode contains either 32 bars, 52 bars or 62 bars (including frame bars and check digit, see below).

POSTNET is a numeric symbology. Different from most other symbologies, POSTNET has requirement to the actual bar height and width. The information is encoded in the height and has nothing to do with the spaces.

Structure of a POSTNET symbol

A POSTNET barcode starts with a long bar (frame bar) and ends with a frame bar. Between these two frame bars is the encoded address information followed by a check digit. Each code character is made up of five bars, either long or short. If we use 1 to represent the long bar, 0 to represent the short bar, each character is encoded based on the table to the left.

Check Digit Calculation

POSTNET contains a check digit, which is based on Mod 10 algorithm. The value of the check digit is that when added to the sum of other digits in the barcode, results in a total that is multiple of 10. For example in the diagram above, the check digit for 91801 is 1 because 9+1+8+0+1+1=20 which is two times of 10.

Barcode Location

Royal Mail Barcode (RMS4CC)

$
0
0

Royal Mail Barcode (RMS4CC)

The Royal Mail 4-state Customer Code(RM4SCC) is a height-modulated barcode symbology for use in automated mail sort process. There are 38 valid characters in the entire character set:

  • Numeric characters 0-9;

  • Upper case letters A-Z;

  • Open and close brackets ( and ) or [ and ] (only used as start/stop bars)

Figure 1. Royal Mail Character Set

Royal Mail Character Set

Each RM4SCC character consists of four bars, of which two are ascenders and two descenders. The track element is present in all bars.

Structure of a RM4SCC symbol

A complete RM4SCC is made up by a set of distinct bars and spaces for each character, followed by a checksum character and enclosed by a unique Start bar, Stop bar and a quiet zone. The start bar and stop bars are unique and different; thus enable the symbol to be read in any direction. The quiet zone must be at least 2mm in each direction.

Checksum Character Calculation

The checksum character is printed on the right hand of data characters to provide error protection. To calculate the checksum character, perform the following steps:

  • Calculate the upper half and lower half values for each data character. A character splits horizontally into an upper half and a lower half. From the right to the left assign each bar a weight. The rightmost bar has a weight of 0, and the second rightmost 1, and third 2 and the leftmost 4.

  • Based on absence of an ascender and descender, assign a multiplier to each bar. For the upper half, if the ascender is present, the multiplier is 1 otherwise is 0.

  • Multiply the weight and multiplier for each half. Sum together to produce the combination value for each half. If the combination value equals six the value goes back to zero.

  • Sum all the values calculated in step 3 to produce upper half and lower half combination totals. Dive each half total by six to get the remainder.

  • Look up the table below, use the combination value of upper half as the row reference, the combination value of lower half as the column reference.

Table 1. RM4SCC Checksum Calculation Table

  Column
Row 1 2 3 4 5 6
1 0 1 2 3 4 5
2 6 7 8 9 A B
3 C D E F G H
4 I J K L M N
5 O P Q R S T
6 U V W X Y Z

Note that the checksum algorithm is only performed on the main data characters contained the code. The Start and Stop bar do not participate the checksum calculation.

Barcode Format

The customer barcode must be a continuous string of characters and must not include white space characters. The code density is 20 to 24 bars per 2.54 cm (20 ~ 24 bars per inch). For detailed requirement on barcode placement and printing requirement, refer to UK postal office.

Interleaved 2 of 5 (ITF25)

$
0
0

Interleaved 2 of 5 (ITF25)

Interleaved 2 of 5 is based on Standard 2 of 5 symbology, but uses both bar and space width to encode information so the density of ITF25 is much higher. It is primarily used in the warehouse industry.

Interleaved 2 of 5 encodes any even number of numeric characters in the width of both bars and spaces.

It is called Interleaved because 2 characters are encoded in a unit of 5 bars and spaces. The even position character is encoded into bars whilst the odd position character is encoded into spaces. Thus, Interleaved 2 of 5 symbology can only encode data elements with even number length.

Other Names

  • Interleaved 2 of 5 Mod 10

  • USS ITF 2/5, I-2/5 or ITF 2of5

Structure of an Interleaved 2 of 5 Symbol

A typical Interleaved 2 of 5 barcode has the following structure:

  • A start character bsbs

  • Message encoded

  • A stop character bbsb

Check Digit Calculation

  1. Start with the right-most digit in the message; mark the character with even and odd position. The right-most digit has the even position.

  2. Sum all digits in the odd position;

  3. Sum all digits in the even position, and then multiply by 3.

  4. Add the result 2 and result 3;

  5. Divide the result of step 4 by 10, the check digit is the result equal to that 10 minus the remainder.

ITF14

ITF-14 is the GS1 implementation of an Interleaved 2 of 5 bar code to encode a Global Trade Item Number. ITF-14 symbols are generally used on cartons. ITF-14 always encodes exact 14 digits.

Printing 2D barcode using fonts from Visual Basic 6

$
0
0

Printing 2D barcode using fonts from Visual Basic 6

In Visual Basic you can "print" to more than just a physical printer. You can print to a form, a picture control, and also to any physical printer connected to your PC or to any shared network printer to which your PC is connected.

The following three statements print "test" to a form, a picture box, and a printer:

  form1.print "test"
  picture.print "test"
  printer.print "test"

Although three share the identical syntax, they produce very different results. Understanding the difference is important to produce high quality barcodes.

In the first prints, the drawing surface is the screen. A screen has a nominal resolution at 96 dpi, meaning that 1 pixel has a width of approximately 10 >mils [1]. A typical laser printer on the contrary has a resolution of 600 dpi, which translates to 1.67 mils per pixel. The difference means that you can achieve much high precision by printing directly to the printer.

In most occasions, the barcode images drawing on screen is for visual demonstration only. It is unnecessary for the barcode on the screen to be readable by a scanner.

Some customers mistakenly believe that the drawing is always scalable among different devices. They print the barcode to a picture box first, and then print the picture box out to the printer. Although vector graphics is scalable among devices, raster images do not. As a result, the barcodes produced have very low quality.

In summary, never print barcodes to screen first and transfer the resulted images later to the printer. Always print to the printer directly.

Printing Tips

We'll briefly review the printing features provided by the VB here. These samples show some of the most typical printing tasks you'd likely need.

Scale Mode

The ScaleMode determines the measurement unit you are going to use. You can set the scale mode to pixels, twips, inches, centimeters, points, character, and millimeters. Because of the resolution, the pixels scale mode is not portable among devices. 100 pixels appear much longer on a screen than on a printer.

EndDoc

When you print to a form or picture box, the image appears immediately. This is not the case for the printer. You must explicitly tell the printer where a page stops. Call EndDoc method when you finish all the drawings.

Printing at a specified location

If you'd like to print the barcode at a specified location, that is say 6 inch down and 1 inch over, you must set the currentx and currenty properties accordingly, as the code below:

  printer.scalemode = vbinches 
  printer.currentx = 1.0 
  printer.currenty = 6.0 

Print multiple lines

Visual Basic moves the printer cursor down a line after printing a line. Unfortunately the VB always moves the cursor to the left side of the printer. To have the lines started from the same currentx, you need to save this property and set it before calling Print:

  pos_x_save = printer.currentx 
  printer.print "line 1" 
  Printer.currentx = pos_x_save 
  printer.print "line 2" 
  printer.currentx = pos_x_save 

Parse the barcode string

The print method does not recognize line feed and carriage return characters. On the other side, the Datamatrix/PDF417 font encoder returns a single string separating lines with line feed and carriage return characters. You can specify the line separator with other strings, but the encoder always returns a single string. To get line by line you can use the split function provided by VB:

  Dim separator As String 
  Dim lines() As String 
 
  separator = vbCrLf 
  lines() = split(encoder_results, separator) 
  MsgBox "Total "  & UBound(lines) & "lines." 

Sample Code

The code below prints a Data Matrix barcode at a point 1.5 inches to the left edge of the page, 3.0 inches from the top. The barcode string is stored in an edit control called BarcodeEdit. Replace BarcodeEdit.Text with your barcode string.

  Private Sub Command_Print_Barcode_Click()
  'To print the barcode, we recommend using the built-in Printer object
  'Do not print to a picture box and transfer it to printer. That results
  'in a low quality barcode.
 
  'You can change it to other values to adjust the barcode size.
  Printer.FontSize = 12
  Printer.FontName = "MRV DataMatrix"
 
  'We use inch as measurement unit here.
  Printer.ScaleMode = vbInches
 
  'We want to print the barcode at point (1.5 inch, 3 inch)
  'Note - printer usually has a margin 0.25" at four directions.
  'You may consider this fact when you set the printer cursor
  Dim StartX, StartY As Double
  StartX = 1.5
  StartY = 3#
  Printer.CurrentX = StartX
  Printer.CurrentY = StartY
 
  'The Priner always go back to the left edge of the page after executing
  'a print statement. Unless we print the barcode to the left ledge of the page,
  'we have to parse the barcode string into lines, and print them one by one.
  'Fortunately, VB provides a nice helper function for this purpose.
  Dim separator As String
  Dim lines() As String
  separator = vbCrLf
  lines() = Split(BarcodeEdit.Text, separator)
 
  'Now we do the actual print line by line
  Dim i As Integer
  For i = 0 To UBound(lines) - 1
   Printer.Print lines(i)
   'Note: the Printer always go back to the beginning of the next line
   'after executing Print. We need to set CurrentX every time after printing a line
   Printer.CurrentX = StartX
  Next
 
  'EndDoc must be called to actual print
  Printer.EndDoc
 
  End Sub


[1] 1 mil = 1/1000th inch.

Code 93 Specification

$
0
0

Code 93 Specification

Code 93 was designed to provide a higher density and data security enhancement to Code39. It is an alphanumeric, variable length symbology. code93 is used primarily by Canadian postal office to encode supplementary delivery information. Every symbol includes two check characters.

Code93 has a native character set of 26 upper case letters, 10 digits and 7 special characters:

A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -, ., *, $, /, +, %, SPACE.

Each Code93 character is divided into nine modules and always has three bars and three spaces. In this way comes the symbology name.

In addition to 43 characters, code93 defines 5 special characters: and . represents start/stop characters; while the last four circular symbols can be combined with other characters to unambiguously represent all 128 ASCII characters. The character encoding under the full ASCII mode is very similar to the one in extended Code39 except the component characters, $, %, / and + are replaced by 4 special characters and respectively.

In an open system, the minimum value of X dimension is 7.5 mils. the minimum bar height is 15 percent of the symbol length or 0.25 inches, whichever is greater. The starting and trailing quiet zone should be at least 0.25 inches.

Structure of a code 93 barcode

A typical code 93 barcode has the following structure:

  • A start character

  • Message encoded

  • First check character C

  • Second check character K

  • Stop Character

  • Termination bar

Check Digit Calculation

To calculate the check character "C" and "K", follow the following steps.

  • Take the value (0 through 47) of each character in the barcode (see the table below). The start and stop characters are not included in the checksum calculation.

  • Assign the weight for each character. The right-most character has a weight value of 1, the second to last 2 and so on. After 20, the sequence goes back to 1.

  • Multiply the character value with weight. Sum all the results.

  • Divide the result by 47 and get the remainder. Reverse look up the remainder to get the character. This is check character "C".

  • Append the "C" character at the end of the data, and repeat the step1 through step 4. This time the weight ranges from 1 to 15. The result is the character "K".

Table 1. Code93 Character Value Table

char value char value char value char value
0 0 A 10 N 23 - 36
1 1 B 11 O 24 . 37
2 2 C 12 P 25 SPACE 38
3 3 D 12 Q 26 $ 39
4 4 E 14 R 27 / 40
5 5 F 15 S 28 + 41
6 6 G 16 T 29 % 42
7 7 H 17 U 30 43
8 8 I 18 V 31 44
9 9 J 19 W 32 45
    K 20 X 33 46
    L 21 Y 34    
    M 22 Z 35    

PRB: Crystal Reports Crashes When Preview the Report

$
0
0

PRB: Crystal Reports Crashes When Preview the Report

SYMPTOMS

You created a report using one of UFLs. When you print preview the report, Crystal Reports designer crashed. On some computers, you receive an application error Unhandled win32 exception occurred in crw32.exe.

This error happens on certain versions of Crystal Reports and on computers with DEP (Data Execution Prevention) turned on.

CAUSE

Earlier versions of Crystal Reports (Crystal 9.0 and 8.5) contains bug in calling COM-based UFL. When the computer has DEP turned on, this bug triggers a DEP exception.

RESOLUTION

You can either upgrade the Crystal Reports to version 10 or above, or turn off the DEP protection for crw32.exe.

To turn off the DEP protection for crw32.exe, perform the following steps:

  1. Open System by clicking the Start button Picture of the Start button, clicking Control Panel, clicking System and Maintenance, and then clicking System.

  2. Click Advanced System Settings. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  3. Under Performance, click Settings.

  4. Click the Data Execution Prevention tab, and then click Turn on DEP for all programs and services except those I select.

  5. Click on Add. Browse to the Program Files folder, find the executable file crw32.exe (for example C:\Program Files (x86)\Crystal Decisions\Crystal Reports 9), and then click Open.

  6. Alternatively you can choose Turn on DEP for essential Windows programs and services. Under this setting, all executables except Windows programs are DEP excluded.

Note: the DEP is applied on process level. If your application or some other processes call Crystal Reports dll, you need to put the location of the process into the exclusion list. Alternatively, you can disable DEP on Windows level.

  1. Disable DEP at boot time: http://msdn.microsoft.com/en-us/library/ff542275.aspx. In a system admin console, type BCDEdit /set {current} nx AlwaysOff.

  2. Change BIOS settings to disable NX/xD bit.


Setting up LPR Printing on Windows 7/8

$
0
0

Setting up LPR Printing on Windows 7/8

On Windows 7 and 8, the default installation does not install lpr command. In order to test PCL fonts on a network printer, you need to install this command first. This article shows how.

Procedure 1. Procedure to install LPR command on Windows

  1. Click Start and choose Control Panel.

  2. Select Programs and Features.

  3. Select Turn Windows features on or off from the menu on the left.

  4. In the Windows Features on or off window that appears, click on the + sign in front of Print and Document Services and check the boxes for LPD Print Service and LPR Port Monitor. Click OK.

  5. Open command promp and enter lpr/?. You should see the following output, which indicates that the command is installed correctly.

    C:\Users\morovia>lpr /?
    
    Sends a print job to a network printer
    
    Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x] [-d] filename
    
    Options:
          -S server    Name or ipaddress of the host providing lpd service
          -P printer   Name of the print queue
          -C class     Job classification for use on the burst page
          -J job       Job name to print on the burst page
          -o option    Indicates type of the file (by default assumes a text file)
                       Use "-o l" for binary (e.g. postscript) files
          -x           Compatibility with SunOS 4.1.x and prior
          -d           Send data file first     
            

INFO: Use LPR Command to Send PCL Font to Printer

$
0
0

INFO: Use LPR Command to Send PCL Font to Printer

Introduction

KB#10002 explains how to download PCL fonts using Copy command. To use this approach, the printer must be physically connected to a computer via a parallel or USB port and shared across a Windows network. Another widely deployed solution is to connect the printer to the LAN directly using a built-in network adapter or a print server adapter. This configuration allows computers running operating systems such as UNIX and Macintosh to print using LPD protocol.

Note

To use this approach, the printer must be connected to a TCP/IP network directly and has the PCL interpreter built in. Some printers rely on the host driver to interpret PCL commands and do not accept direct PCL stream. Check with your printer configuration to make sure that the PCL interpreter is built in the printer itself.

Before we go details about LPR command, it is necessary to explain two terms used in the LPR.

Printer Name

The printer name refers to the host name or the IP address of the printer device, depending on the network configuration. A TCP/IP device may be identified with a full qualified DNS name, or an IP address. In our test lab, we assign our network printer a fixed IP address 192.168.1.22, and we use this address in the examples below.

Queue Name

The queue names are names assigned to the "processors" in the print server. Most print servers and network printers have the queue names hardcoded. On HP JetDirect printer servers, the raw PCL queues are named as raw, raw1, raw2 and raw3. In the below example we use raw as the queue name. Replace this name with the one from your printer.

Tip

If you installed the printer driver on Windows, you can locate the LPR settings in the Port Settings dialog. To do this, first right click on the printer in Printer and Faxes list and select Properties. Select Ports tab and click on Configure Port... button. You can find Printer Name and Queue Name in the dialog followed.

Example Files

The example files are the same as the one in KB#10002. To download the files, visit KB#10002.

Steps to send fonts to the printer

As indicated in KB#10002, you perform three steps to send the font to a printer. The first command, Font ID, assigns a unique number to the font followed. After that you send the font binary file to the printer. The last step makes the font permanently reside in the RAM by sending the Make Font Permanent command.

Note

The font resides in the printer RAM; therefore it can not survive a power outage or power reset. To make sure that you always have the font available, repeat the font downloading steps at the beginning of each print job.

In our example, we store the data in three separate files: font-id.txt, code39ma.sfp, set-font.txt. We can use copy to send them in one stream. However, the LPR command does not support concatenating files. We need to combine these three files into one first and this can be done using the COPY command:

copy /b font-id.txt +code39ma.pcl +set-font.txt  total.bin 

After we combine the three files into one, we can then use lpr to send the font:

lpr -S 192.168.1.22 -P raw -o l total.bin

The option -o l is needed to send the file in binary format to the printer.[1]

After we complete sending the font, we can send the content.txt to the printer to print a test page:

lpr -S 192.168.1.22 -P raw -o l contents.txt

Note: the lpr option l is the l as in lucy, not digit 1.



[1] This option is available on Windows only.

Code 39 Specification

$
0
0

Code 39 Specification

Code 39 (also known as Code 3 of 9, Code 3/9, USS Code 39, Code three of nine, or USD-3) is the first alpha-numeric symbology developed to be used in non-retail environment. It is widely used to code alphanumeric information, such as the model number etc.

Code39 is capable of encoding 26 upper case letters, 10 digits and 7 special characters:

A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 -, ., *, $, /, +, %, SPACE.

It Is called code 39 or three of nine because each character encoded is made up of 5 bars and 4 spaces for a total of 9 elements and 3 out of 9 element are always wide.

A complete code 39 barcode must include a start character * and a stop character *. In this way code 39 is self-checking.

The height of the bars must be at least 0.15 times of the symbol’s length or 0.25 inches, whichever is larger.

Code 39 is a discrete symbology. Two adjacent characters are separated by an inter-character gap. To have the good barcode quality, the width of the inter-character gap usually equals to the width of the narrowest element, called X.

Code39 requires a starting quiet zone with the minimum 10 times of X dimension or 0.10 inch whichever is greater. The same width requirement applies to the trailing quiet zone.

Variants

  • Code 39 Mod 43 — In applications that require very high level of accuracy a modulo 43 check sum digit is appended to the last character. Also known as HIBC and LOGMARS.

  • Code 39 Extended — this encoding variant allows all 128 ASCII characters to be encoded.

Code 39 Mod 43

In this variant, a check character is appended to the end of data encoded, using modulo 43 algorithm. To calculate the checksum digit, follow the steps below:

  1. Take the value (0 through 42) of each character in the barcode. The start and stop characters are not included in the checksum calculation.

  2. Sum the value of each of the values of each of the characters described in step 1.

  3. Divide the result from step 2 by 43.

  4. The remainder from the division in step 3 is the checksum character that will be appended to the data message before the stop character.

Table 1. Code39 Character Value Table

char value char value char value char value
0 0 A 10 N 23 - 36
1 1 B 11 O 24 . 37
2 2 C 12 P 25 SPACE 38
3 3 D 12 Q 26 $ 39
4 4 E 14 R 27 / 40
5 5 F 15 S 28 + 41
6 6 G 16 T 29 % 42
7 7 H 17 U 30    
8 8 I 18 V 31    
9 9 J 19 W 32    
    K 20 X 33    
    L 21 Y 34    
    M 22 Z 35    

Extended Code 39

The code 39 symbology can be extended to encode all 128 characters in the ASCII table. In the full ASCII mode, the symbols $ / % and + are used as precedence codes with the 26 letters as shown below. Since the same symbol now can be interpreted as one character in Extended Code 39 mode and two characters in Code 39 mode, the readers must be set to extended mode to read the data correctly. Extended Code39 is sometimes called Code39 Full ASCII.

Val ASCII Encoding   Val ASCII Encoding   Val ASCII Encoding   Val ASCII Encoding
0 NUL %U   32 [space] [space]   64 @ %V   96 ` %W
1 SOH $A   33 ! /A   65 A A   97 a +A
2 STX $B   34 " /B   66 B B   98 b +B
3 ETX $C   35 # /C   67 C C   99 c +C
4 EOT $D   36 $ /D   68 D D   100 d +D
5 ENQ $E   37 % /E   69 E E   101 e +E
6 ACK $F   38 & /F   70 F F   102 f +F
7 BEL $G   39 ' /G   71 G G   103 g +G
8 BS $H   40 ( /H   72 H H   104 h +H
9 HT $I   41 ) /I   73 I I   105 i +I
10 LF $J   42 * /J   74 J J   106 j +J
11 VT $K   43 + /K   75 K K   107 k +K
12 FF $L   44 , /L   76 L L   108 l +L
13 CR $M   45 - -   77 M M   109 m +M
14 SO $N   46 . .   78 N N   110 n +N
15 SI $O   47 / /O   79 O O   111 o +O
16 DLE $P   48 0 0   80 P P   112 p +P
17 DC1 $Q   49 1 1   81 Q Q   113 q +Q
18 DC2 $R   50 2 2   82 R R   114 r +R
19 DC3 $S   51 3 3   83 S S   115 s +S
20 DC4 $T   52 4 4   84 T T   116 t +T
21 NAK $U   53 5 5   85 U U   117 u +U
22 SYN $V   54 6 6   86 V V   118 v +V
23 ETB $W   55 7 7   87 W W   119 w +W
24 CAN $X   56 8 8   88 X X   120 x +X
25 EM $Y   57 9 9   89 Y Y   121 y +Y
26 SUB $Z   58 : /Z   90 Z Z   122 z +Z
27 ESC %A   59 ; %F   91 [ %K   123 { %P
28 FS %B   60 < %G   92 \ %L   124 | %Q
29 GS %C   61 = %H   93 ] %M   125 } %R
30 RS %D   62 > %I   94 ^ %N   126 ~ %S
31 US %E   63 ? %J   95 _ %O   127 DEL %T, %X, %Y, %Z

Structure of Code 39 Barcode

A typical code 39 barcode has the following structure:

  • A start character – the asterisk(*)

  • Message encoded

  • Optionally the check digit based on mod 43 algorithm.

  • A stop character – the second asterisk(*)

UPC-A Specification

$
0
0

UPC-A Specification

The UPC-A barcode is the most common and well-known symbology in the United States. You can find it on virtually every consumer goods in your local supermarket, as well as books, magazines, and newspapers. There are a number of UPC variants, such as UPC-E, UPC 2-digit Supplement, UPC 5-digit supplement.

UPC-A encodes 11 digits of numeric data along with a trailing check digit, for a total of 12 digits of barcode data.

Structure of a UPC number

A UPC-A number consists of four areas: (1) The number System; (2)The manufacturer code; (3) the product code; (4)The check digit. Normally the number system digit is printed to the left of the barcode, and the check digit to the right. The manufacturer and product codes are printed just below the barcode, separated by the guard bar.

  • Number System. The number system is the first digit in a UPC number. It identifies the type of the product. For example, if the barcode starts with digit 5, this barcode is a coupon code.

  • Manufacturer Code. The manufacturer code is assigned by the GS1 organization to each manufacturer or company which distributed goods that uses UPC-A barcode. You cand find your local GS1 organization at http://www.gs1.org.

    Traditionally manufacturer code was 5 digits in length. However the numbers have been running out and new customers are now getting 8-digit manufacturer code, meaning that there are only 100 item codes available to assign.

  • Product Code. The product code is assigned by the manufacturer. Because the combined length of manufacturer code and the product code is 10 digits, the number of product codes available depend on the length of manufacturer code.

  • Check Digit. The check digit is used to verify that the barcode is generated or scanned correctly. The check digit is calculated based on the rest of the barcode digits. Read the following section to learn how to calculate the check digit.

Table 1. Number System List

Number System (NS) Description
0 Regular Item
1 Regular Item
2 Reserved for local use (store/warehouse), for items sold by variable weight. Variable-weight items, such as meats and fresh fruits and vegetables, are assigned a UPC by the store, if they are packaged there
3 Drugs by National Drug Code number. Pharmaceuticals in the U.S. have the remainder of the UPC as their National Drug Code (NDC) number; though usually only over-the-counter drugs are scanned at point-of-sale, NDC-based UPCs are used on prescription drug packages and surgical products and, in this case, are commonly called UPN Codes.
4 Reserved for local use (store/warehouse), often for loyalty cards or store coupons.
5 Coupons.The last two digits determines the amount of the discount. See this link for the details. The remaining contain manufacturer and item information.
6 Regular Item
7 Regular Item
8 Regular Item
9 Coupons

Encoding

A UPC-A symbol can be divided into two halves, each consisting of six digits separated by a center guard bar pattern. The whole symbol is surrounded by two guard bar patterns. The same digit has different encoding depends whether it is in the left haf or in the right half. The encoding pattern for digits in the left halve always starts with a space while the one for digits in the right halve always start with a bar and ends with a space.

A UPC-A symbol has the following structure:

  1. Start guard bars, always with a pattern bar+space+bar.

  2. Left halve, six digits encoded using the encoding schema A or B;

  3. Center guard bars, with a pattern space+bar+space+bar+space.

  4. Right halve, six digits encoded using the encoding schema C.

  5. Stop guard bars, always with a pattern bar+space+bar.

Check Digit Calculation

UPC-A check digit is calculated using standard Mod10 method. Here outlines the steps to calculate UPC-A check digit:

  1. From the right to left, start with odd position, assign the odd/even position to each digit.

  2. Sum all digits in odd position and multiply the result by 3.

  3. Sum all digits in even position.

  4. Sum the results of step 3 and step 4.

  5. divide the result of step 4 by 10. The check digit is the number which adds the remainder to 10.

A web-based free utility to calculate UPC-A check digit is available at http://www.morovia.com/education/utility/upc-ean.asp.

MSI/Plessey Specification

$
0
0

MSI/Plessey Specification

MSI Data Corporation introduced MSI from the original Plessey Code. Therefore, MSI is also known as Modified Plessey. It is mainly used in retail business.

MSI/Plessey is a fixed-length, non-self-checking symbology.

Most applications still support MSI only for backward compatibility, because MSI/Plessey is based on Pulse-Width Modulation technology.

MSI requires start/stop characters. MSI is used to encode numeric data and check digit is required to add at the end of the data.

Variants

MSI is sometimes called Plessey Code or MSI/Plessey.

Structure of a MSI/Plessey symbol

A typical MSI/Plessey barcode has the following structure:

  • A start character

  • Message encoded

  • Check digit

  • A stop character

Check Digit Calculation

MSI uses one or two check digits, which may be calculated in a number of different ways. As such, it is really up to the software application to implement and check the check digit(s).

The most common method of calculating MSI check digit is Modulo 10.

To calculate the modulo 10 checksum digit, use the following steps:

  1. Create a new number using every other digit from the original code such that the right-most digit of the new number is the right-most digit of the old number. For example, in the barcode above the data we encoded was "8052". In this case, the "new number" is 02.

  2. Take the new number calculated in step 1 and multiply it by 2. In this case, 02 * 2 is 4.

  3. Add the digits of the value calculated in the previous step (4), and add it to the digits that were not used in step 1 to form the new number. In our example, this would be 4 + 8 + 5 = 17. The "4" comes from step 2, the 8 and 5 come from the "8052" and are the digits that weren't used to form the new number in step 1. If the result from step 2 were, for example, 123, then we'd add 1 + 2 + 3 = 6 (plus the digits that weren't used from step 1).

  4. Do a modulo 10 calculation on the result of step 3. In this case, 17 modulo 10 = 7.

  5. The check digit is the value which, added to the result in step 4, equals 10. In this case, we must add 3 to 7 to get 10-so the check digit is 3.

Codabar Specification

$
0
0

Codabar Specification

Codabar was developed in 1972 by Pitney Bowse, Inc. Codabar is a discreate, self-checking symbology. In Japan, it is called NW-7(Japanese standard JIS X0503)

Codabar has a character set of 16 letters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -, $, :, /, ., +.

Codabar has four start/stop characters we refer here as A, B, C and D.

Codabar is used in US blood banks, photo labs, and Fedex airbills.

The minimum value of X is 7.5 mils. The wide-to-narrow (N) ratio shall be between 2.0 and 3.0 and remains constant in the symbol, and N must exceed 2.2 if X is less than 20 mils. The minimum bar height is 15 percent of the symbol length or 0.25 inches, whichever is greater.

Variants

There is no check digit required for codabar, though some applications opt to append a check digit at the end of the message.

FedEx Airbills use a variant of codabar. A FedEx airbill number has the format of XXXX-XXXX-XXXY with an additional 4-digit format ID. The Y character is a check digit with the algorithm unknown to public. The first 12 digits is the track number. The barcode itself starts with start/stop character C and ends with start/stop character D.

Structure of a Codabar Barcode

A typical Codabar barcode has the following structure:

  • A start character from 4 choices: A, B, C and D.

  • Inter-character gap space

  • Encoded message

  • A stop character from 4 choices: A, B, C and D.

Check Digit Calculation

No check digit is used in Codabar symbology.

AIM Symbology Identifiers (SI)

$
0
0

AIM Symbology Identifiers (SI)

It is often desirable to record the barcode format along with the decoded message. In this way the application is able to produce the barcode at later stage. For this purpose AIM organization defined a standard on the use of symbology Identifier, a.k.a. SI. Not all barcode readers is capable of producing SIs. The SI prefix is a three character string:

]cm

where -

]

SI indicator

c

Symbology Identification

m

a Modifier character

Symbology Character

A Code39
B Telepen
C Code128
D Code One
E EAN/UPC
F Codabar
G Code93
H Code11
I ITF25
K Code16K
L PDF417
M MSI code
N Anker Code
O Codablock
P Plessey Code
R Straight 2 of 5 (two bar start/stop codes)
S Straight 2 of 5 (three bar start/stop codes)
T Code49
X Other Barcode
Z Non Barcode data

Modifier Character

The modifier character is determined by summing the option values of each symbology. For sum less than 9, use digit 0-9 respectively. If the sum is greater than 9, use A, B, C, D, E , F in the place of 10, 11, 12, 13, 14 and 15.

Code39 Option Values

0 No check character or Full ASCII
1 Reader has performed mod 43 check
2 Reader has performed mod 43 check and stripped the check character
4 Reader has performed Full ASCII conversion

Code 128 Option Values

0 Standard
1 Function code 1 in first character position
2 Function code 2 in second character position
4 Concatenation according to ISBT specification has been performed, and concatenated data follows.

Interleaved 2 of 5 Option Values

0 No check digit processing
1 Check digit has been checked
2 Check digit has been stripped

How Barcode Reader works

$
0
0

How Barcode Reader works

Bar coder readers decodes a bar code by scanning across the bar code and measuring the intensity of the light reflected back. The light variation is converted into digital signal. Due to barcode design, it does not matter you scan from the left to right or from the right to left.

A barcode reader contains two parts. The first part is the scanner that scans the image and coverts into digital representation (01111000). The second part is the decoder which combines the binary digital signals into a series of characters. The decoded information is sent to the computer via keyboard or serial interfaces.

Input Device

An input device accepts the reflected light and converts the optical reflection into digital/analog signals. There are two major methods used for input, laser beam and CCD (charge-coupled device). CCD scanners can be very small, but they have less depth of filed than laser scanners.

Decoders

A decoder decodes the symbol’s information and passes to the host computer or stores in the memory. A decodes accepts the digital signal from the input device, and converts the signals into bar and spaces. Then it quantify the element width, decode the signal based on the quantified widths. Finally, it performs some other check such as check characters. After the decoding process is complete, it transmit the data into host computer.

Decoders can be divided into two categories: on-line decoders and portable decoders. The on-line decoders use the power from AC adapter or from the computer, and the latter uses the battery.

Symbology Identifier (SI)

A barcode reader usually accepts inputs of multiple symbologies. For some applications it is usually nice to know what kind of symbology the data is encoded. For this reason AIM has published a standard of prefix to describe the symbology. The prefix takes the form ]cm, where:

]

the symbology identifier flag

c

the code identifier character

m

additional options

Currently the hardware support for this feature is somewhat limited. If your application does use this filed, you need to contact the vendor before your purchase the hardware.

Barcode Reader Interface

$
0
0

Barcode Reader Interface

Keyboard Wedge

This type of barcode reader is attached through the keyboard interface, the barcode reader sends data in scan codes (the codes used by IBM PC keyboards), exactly as you pressed the keys in the keyboard. It is called Wedge reader because they physically wedge between the keyboard and computer, as depicted the diagram below.

Since the barcode reader can use the power from the keyboard cable, no external power is needed. On the other side, this configuration is not designed for communication which has a distance more than 25 feet.

USB-based keyboard wedge

A special type of keyboard wedge barcode readers is the one using now-popular USB technology. It is similar to the keyboard wedge reader above, but uses the USB interface. No driver is needed too and the data is placed directly in the keyboard buffer. It is convenient to use with a notebook because the latter does not have an external keyboard.

Only Windows 98 or above platforms (including Windows ME, 2000 and XP) supports USB configuration. The OS treats the reader as a USB keyboard and automatically places the input in the keyboard buffer.

Keyboard Wedge interface is very simple to use. However, you must point the cursor to the correct input box and make sure that the cursor always stay in the right place before you press scan button. Theoretically a host computer can connect multiple barcode readers using this configuration, but the application has no knowledge about where the data comes from. Since the barcode reader receives power from the computer, this type of configuration does not need external power. The old application does not need to be modified to accommodate this configuration.

Serial Port

The barcode reader is connected to one of the serial ports of the computer. Software is needed to retrieve the information. It can be done in your application, or you place some programs coming with the barcode reader who simply reads the data and place them in the keyboard buffer. The communication takes the standard RS232 or RS432. An external power adapter is required for operation, and the distance can be as far as 250 feet. A host computer can connect as many barcode readers as the number of serial ports.

Windows provide a COM component called MSCOMM. Using this COM component your application retrieve the data from the OnComm handler. Win32 also provides serial communication APIs but this method requires advanced skills.

Portable Batch

This type of barcode reader has memory powered by battery. Usually it also has keyboard, LCD display and is programmable. The data is stored in the memory first and then dumped into the computer via a dock station. The data is usually transmitted in a comma-delimited text file format. The dock station also acts a recharge station.

RF Cordless

Under this configuration a RF base station is connected to the computer through keyboard wedge or serial interfaces. The barcode reader communicates with the base station via radio frequency. The transmission rates are in the 1200 to 4800 baud range. The battery usually lasts much longer than the portable batch readers.

INFO: VBA Example to Use Barcode Functions in MS Word

$
0
0

INFO: VBA Example to Use Barcode Functions in MS Word

SUMMARY

This article provides some information on converting selected text into barcodes using barcode fonts and VBA functions.

MORE INFORMATION

In the first part of this tutorial, we'll demonstrate how you can create a macro that turns the selected text into a UPC-A barcode. Later on, we'll show you how to associate the macro with a keyboard shortcut or menu item so that you can invoke the macro by pressing a key or selecting a menu item.

In order to use this tutorial, you need to have Microsoft Word 2000 and above and have the Macro enabled. You will also need Morovia UPC/EAN/Bookland Fontware. If you have other linear barcode fonts package, substitute the font name and encoder function with the ones in your package. You do not need the full version - the trial version will do just fine.

Macro can be in global scope or in document scope. If a macro is placed into normal.dot template, which is loaded into every Word document, it is visible to every document. Otherwise it resides on the specific document you are working on. In this tutorial we place macro into the document we are working on. If you need to reuse the macro frequently you may consider to place into normal.dot template to make it global.

Creating a Macro

  1. Open you document (referred as barcode.doc in this tutorial). Pop up Macros dialog with ToolsMacroMacros (ALT+F8). On Word 2007, first switch to Developer toolbar by clicking on Developer menu, then click on Macros tool button.

  2. In the Macros, enter name CreateUPCBarcode and choose Create.

  3. Now Visual Basic Window appears with the definition of subroutine CreateUPCBarcode. The VBA editor created the function and the body is left to fill out. Enter code in the body, to make the whole definition looks like below:

    Sub CreateUPCBarcode()
      Selection.Font.Name = "MRV UEBMA"
      Selection.Font.Size = 12
      Selection.TypeText (UPC_A(Selection.Text))
    End Sub

    The code first changes the font of selected text to MRV UEBMA, then calls function UPC_A to convert selected number into barcode string. After that, it overwrites the current selection with barcode string.

  4. Before we close the editor, we need to import Morovia VBA module because the macro calls an encoder function UPC_A which is defined in Morovia Font Tools module. Right click on the Project (barcode.doc) node and select Import File. Navigate to the folder c:\program files\common files\morovia\moroviafonttools and locate moroviafonttools.bas file. Click OK. Make sure that you only import this file once.

Applying Macro

After the macro is created, it can be applied manually. In the document, type our UPC number 01234567891 and highlight it. Pop up Macros dialog with ToolsMacroMacros (Alt+F8). Select CreateUPCBarcode and click on Run. The highlighted number becomes a UPC-A barcode.

Assigning Shortcut to Macro

After the macro is defined, you can assign the macro to a toolbar button, or a keyboard shortcut. Let's assign our new macro shortcut Ctrl+Alt+B.

  1. Right-click within the gray area at the top of Word –- inside the menu bar, within the toolbar (but not on a button), or in the gray, empty area to the right of the menus and toolbar buttons. Choose the Customize command (Alternative: ToolsCustomize).

  2. Choose the Command tab in the Customize dialog box. Choose the Keyboard... button at the bottom of the Customize dialog box.

  3. In the Save changes in pull-down menu at the bottom, choose the current document barcode.doc. In the Categories list, choose Macros, and in the right panel you'll find the CreateUPCBarcode macro.

  4. Click inside the Press new shortcut key text box. Press the shortcut key you'd like to use, such as Ctrl+Alt+B (this combination will appear in the text box). If the key combination hasn't been assigned to another command, Word displays Currently assigned to: [unassigned]. Click on the Assign button.

  5. The shortcut appears in the Current keys list. Dismiss all dialogs.

To undo the change, use the Tools/Customize command, then right-click the button and choose Delete. Alternatively, hold down the Alt key and drag the icon off the toolbar.

Assigning Menu Item to Macro

You can also assign a menu item to the new macro.

  1. Right-click within the gray area at the top of Word –- inside the menu bar, within the toolbar (but not on a button), or in the gray, empty area to the right of the menus and toolbar buttons. Choose the Customize command (Alternative: ToolsCustomize).

  2. Choose the Command tab in the Customize dialog box. In the Save in pull-down menu at the bottom, choose barcode.doc. In the Categories list, choose Macros, and in the right panel you'll find CreateUPCBarcode macro (it's listed as Project.Module1.CreateUPCBarcode).

  3. Drag the macro icon (it looks like a small organization chart or flowchart) to the Edit menu. Word opens the Edit menu.

  4. Move down the Edit menu. Your mouse cursor changes into a button, and as you move a dark vertical line appears in the menu at the position where you will be "dropping" (inserting) the new command. When you are satisfied with the location, release the mouse, dropping the line in the desired position (see Figure 5). The line changes to text: Word displays the Macro name. I chose to add the command between the Replace and the Go To commands.

  5. The Edit menu remains displayed. Right-click on your macro and change the name. I chose UPC-A &Barcode. This allows me to press Alt+E (to open the Edit menu), then press B to execute the macro.

  6. In the Customize dialog box, choose Close.

To undo the change, use the ToolsCustomize, then click on the menu item (to select it) and right-click your mouse and choose the Delete command.

Deleting Macro

When you save barcode.doc, your toolbar, menus, and keyboard shortcuts are saved with your document. Since we assigned the changes to barcode.doc, rather than normal.dot, the changes will be reflected only in barcode.doc. Open any other document (or create a new one) and your menus, toolbars, and keyboard shortcuts won't reflect the shortcut changes you made in barcode.doc.

APPLIES TO

  • Morovia Linear Barcode Fontware

  • Microsoft Word

Installing Fonts with command line script

$
0
0

Installing Fonts with command line script

Many large corporations need to deploy fonts to a large number of computers. However some administrator opt not to use the installer provided. Instead, they want to install the fonts only using a script.

The script below is written in VBScript. It looks into the shared directory \\media-server\FileFolder\fontsourcefolder\ for any files with .ttf extension. It then installs every file found, unless it is already existed in the local machine's font folder.

Option Explicit
Dim objShell, objFSO, wshShell
Dim strFontSourcePath, objFolder, objFont, objNameSpace, objFile

Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = createobject("Scripting.Filesystemobject")

Wscript.Echo "--------------------------------------"
Wscript.Echo " Install Fonts "
Wscript.Echo "--------------------------------------"
Wscript.Echo " "

Const EVENT_SUCCESS = 0
Const EVENT_CRITICAL = 1
Const EVENT_WARNING = 2
Const EVENT_INFO = 4 

strFontSourcePath = "\\media-server\FileFolder\fontsourcefolder\"

wshShell.LogEvent EVENT_INFO, "Installing font - invoke startup script "

If objFSO.FolderExists(strFontSourcePath) Then

Set objNameSpace = objShell.Namespace(strFontSourcePath)
Set objFolder = objFSO.getFolder(strFontSourcePath)

For Each objFile In objFolder.files
 If LCase(right(objFile,4)) = ".ttf" Then
  If objFSO.FileExists(wshShell.SpecialFolders("Fonts") & "\" & objFile.Name) Then
   Wscript.Echo "Font already installed: " & objFile.Name
   wshShell.LogEvent EVENT_INFO, "Font already installed: " & objFile.Name
  Else
   Set objFont = objNameSpace.ParseName(objFile.Name)
   objFont.InvokeVerb("Install")
   Wscript.Echo "Successfully Installed Font: " & objFile.Name
   wshShell.LogEvent EVENT_SUCCESS, "Successfully Installed Font: " & objFile.Name
   Set objFont = Nothing
  End If
 End If
Next
Else
 Wscript.Echo "Font Source Path does not exists"
End If

To execute the script, open a command prompt and enter:

cscript <path-to-script>

Notes

  • This script requires administrator privilege. On Vista and above with UAC turned on, the UAC prompt will pop up. To eliminate it, open an Administrator console first, then execute the script.

  • It is possible to execute the script using GPO policy at computer start-up. You can find instruction at: Assign computer start up scripts. Note that the fonts location and script must be accessible by the computer account. Usually this can be done by adding Domain Computers account into the security/share permission list.

  • Race condition may exists for a computer start up script. For reliable execution, it is recommend to perform on an interactive console (after logged in).

Code 128 Specification

$
0
0

Code 128 Specification

Code 128 is a high-density alphanumeric symbology. Since it was introduced in early 1980s, it has been widely adopted by many industry applications. GS1 derives its retail carton tracking standard GS1-128 (previously known as UCC/EAN-128) based on Code 128 symbology.

Code 128 is capable of encoding all 256 single-byte characters. By default, values above 127 are interpreted as ISO8859-1 characters. It also encodes fours special "function codes" - FNC1, FNC2, FNC3 and FNC4.

Structure of a Code128 Barcode

A typical code 128 barcode has the following structure:

  • A start character

  • Message encoded

  • Check character

  • Stop Character

  • Termination bar (bar+space+bar)

Subtypes

Code 128 includes 107 symbols: 103 data symbols, 3 start codes, and 1 stop code. To represent all 128 ASCII values, there are three code sets (A, B, C), which can be mixed within a single barcode (by using codes 98 and 99 in code sets A and B, 100 in code sets A and C and 101 in code sets B and C to switch between them):

  • 128A (Code Set A) - ASCII characters 00 to 95 (0-9, A-Z and control codes), special characters, and FNC 1-4

  • 128B (Code Set B) - ASCII characters 32 to 127 (0-9, A-Z, a-z), special characters, and FNC 1-4

  • 128C (Code Set C) - 00-99 (encodes each two digits with one code) and FNC1

Start/stop and encoded data

Each character in the barcode symbol is composed of three bars and three spaces. (The stop adds an additional extra bar of length 2.) Each bar or space is 1, 2, 3 or 4 units wide, the sum of the widths of bars must be even, the sum of the widths of the spaces must be odd, and total 11 units per character. For instance, encoding the ASCII value 0 can be viewed as 10011101100, where a 1(One) is a bar and a 0 is a space. A combination which contains a single 1 would be the thinnest line in the bar code. A combination including three 1 (111) in sequence indicates a bar three times as thick as a single 1 bar.

Check Digit Calculation

Every Code 128 symbol requires a check character being placed between encoded data and stop character. The check character is derived from a modulo 103 calculation of the weighted sum of all characters. Here is the procedure to calculate the check character:

  1. Take the value (0 through 102) of each character in the message. This includes the start character, shift character, but excluding the stop character.

  2. Start with the first character of the data, assign the weight for each character. The first character has a weight of 1, the second character has a weight of 2.. and increment by 1. Note that the start character also has a weight of 1. stop character is excluded in the calculation.

  3. Multiply the character value with weight. Sum all the results.

  4. Divide the result by 103 and get the remainder. Look up the remainder in the table to get the check character.

  5. The stop character, and termination bar is appended after the check character.

Viewing all 128 articles
Browse latest View live