Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems
How can you print labels to a thermal printer that is not supported by MEDITECH? The short answer is “by sending all the command strings yourself.” For MAGIC sites, this is just a matter of using a macro or line checks or ECB attributes, which send command strings to the printer along with your data. For C/S sites, the same approach will work if the printer is installed as GENERIC or FARGO in the UNV with a GENERIC/TEXT driver installed on the print server (if any). For details see the MEDITECH MIX article: http://www.meditech.com/MIXMAGTactical/NPRReportWriter/0106Pages/adm.htm.
But how do you figure out what printer codes need to be sent? One method is to get the programming reference manual for the printer language and figure out the initialization codes and command strings that produce the label you want and then code them into your macro. An easier method is to install the printer on your PC and use some label design software to create a template for your label, then send the print data to a file and modify it so that it is suitable to be placed in an NPR Report Macro.
Let’s see how we might create a wristband for a Zebra HC1000. These are toaster sized thermal printers with the labels in a cartridge. These Zebra models use the “ZPL” printer language. Step one is to install the printer so you can use it from your local PC, installing the drivers (typically from www.seagullscientific.com).
If necessary, build a new shelf in your office so that the printer can join its thermal printer friends, here a Citizen 521C and a ancient Datamax Allegro 2.
Next, use some PC based WYSIWYG label design software to layout a “template”, selecting printer resident fonts only, and using placeholders for the data. I like to use Bartender from Seagull Scientific, but you could use the Zebra “label designer” software that ships with the printer or Nicelabel from Nicewear (which actually makes the Zebra bundled software). Note that Bartender offers a 30 day free trial. These products are designed to be both label design and label print server products; you are using only the label design part of their functionality.
Based on the dimensions of your label stock, you define a label size in the software and place your fields and bar codes, using placeholders for the fields. Be sure that the length and format of any data you are going to bar code matches your system. If your account number is ANNNNNNNNNN (leading alpha and 10 digits) then use placeholder data that matches, such as V1234567890.
Here is a sample from Bartender of the layout for a 1x6” baby wristband for a Zebra HC1000.
Notice that the placement of the fields is shifted high on the label, even though the dimensions are correct. This is a quirk of either the driver or the Bartender software that does not occur for other printers. Having a printer to use for testing from the PC using Bartender (or other PC based label design tool) with the actual stock is essential to getting the template built properly so that all the fields print in the correct location. It is much faster to make adjustments on the PC and test print than to code the macro and test from MEDITECH.
Note that you should only select fonts that are “printer resident.” PC based label printing software can use any Windows font, but the non-printer fonts are sent as graphics. From MEDITECH you will only be able to send printer fonts, which can be identified by a printer icon next to the font name:
The PC based product could also print graphics on your label, but it is impractical to try to do this from a MEDITECH NPR report.
Once you have perfected your format, change the printer port on the printer to FILE so that you can capture the printer output from your label design software to a file.
Here in Notepad is the entire print file. The caret ^ is an ASCII 94. If you pasted this into a macro it would become the assignment → operator.
To change this code to be suitable to be used in an NPR RW Macro, you need to do five things:
1) Substitute the appropriate “D Code” for any non-printable character, or character that has a special meaning in NPR code (such as @).
For the Zebra this means doing a search and replace on ^ and replacing with D(94).
2) Put quotes around the strings you need to send. In your searching and replacing the ^ you can replace with "D(94)_” to do some of this automatically.
3) End each line with a Carriage Return/Line Feed and send the line to the printer _D(13,10))^! or _@ Z.cr.lf^! The ^! sends the data to the output device.
4) Substitute NPR field names for the placeholders you used in the template. For example, put @name where you had Lastname,Firstname RestofName
Here is what some of the converted code in a macro looks like for this template above:
5) Take care of any Code-128 bar codes by splitting up the data field as necessary and dealing with the “code shift” command.
Code 128 is a compact symbology because it can send more data in a bar code by handling pure numeric strings in a more compact fashion than it used for mixed strings.
To do this, Code 128 will do a “code shift” when moving from an alpha numeric to a pure numeric part of a string. This is why you need to use the same format (same number of alphas and numerics) in your template placeholder data as appear in your real data.
When we look at the encoding of the V0000020784 account number in our print file, we see the following print string:
The “>:” before the V is the “code shift” for alpha numeric data and the “V” (first character of the account number) follows.
The “>5” before the rest of the account number is the “code shift” for a numeric string, and “00000200784” (2nd thru last character of account number) follows.
In the macro, we need to break the account number into the “first part” (first character), which we put into the variable FP and the “second part” which we put into the variable SP.
With the ^ replaced with D(94), quotes around the literal strings, a carriage return/line feed at the end, this is what it looks like in the macro.
Note that for some printers the first two characters of an account number have a leading single alpha before the “code shift.” If you were working from the printer language technical manual, you would need to figure out the logic needed for your printer. With our method of using PC software, we can just see how the command string needs to be built by printing it to a file and converting it to a macro.
Finally, find a stunt baby and test the fit and functionality of your labels:
Upcoming NPR Training Opportunities:
We are pleased to offer NPR Report Writer training sessions at host sites this fall. Details and a course description are available on our website at http//www.iatric.com/npr/class-schedule.asp.
|Valley Presbyterian Hospital
Van Nuys, CA
|Richard Serrano||Nov. 17-19, 2010||$750|
To subscribe for email notifications for new classes, please follow this link: http://www.iatric.com/npr/class-schedule.asp.