Printing code to LPT1-connected ticket printer

PROBLEM: Printing code to LPT1-connected ticket printer Hi, I’m changing from Navision 3.56 to Attain and am looking for a way to print a text string directly to a ticket printer. I can’t use the report module: I need complete control of every byte sent to the printer. In 3.56 I have the command genDESTINATION(‘lpt1’); this directs the output to lpt1. Easy. With Attain the only work-around I found so far is printing to a file and starting a DOS batch to perform the printing as in this demo code: Demotext := ‘2eC04300170M01101’+‘Hello World’+‘eP00010’; TempDatei.TEXTMODE(FALSE); TempDatei.CREATE(‘c:\printme.prn’); TempDatei.WRITE(Demotext); TempDatei.CLOSE; TempDatei.TEXTMODE(FALSE); TempDatei.CREATE(‘c:\printme.bat’); TempDatei.WRITE(’@type c:\printme.prn > lpt1’); TempDatei.CLOSE; SHELL (‘c:\printme.bat’); This has several disadvantages: - An extra window is opened and closed - I have no control if the printing has worked - I don’t know when the shell job has finished so I can’t delete the files right after printing. Any hints to solve this in a better way? It would help if I could control the Shell and make it start in the background. I’d prefer not to use temporary files at all.

In case someone else is having the same problem, here’s my current better solution: It is possible to print past the Windows printer driver to the windows printer spool (“winspool.drv”) - this way the bytes remain unchainged. This can be done within a DLL (I used Visual Basic for this) and the DLL can be accessed in Attain as an Automation type variable. I still need to work out a way to pass more than 1000 characters to the DLL but that should be possible as well.

I think you can find activex to do that, or better make an ocx yourself, so you have complete control

I use the following code with a Zebra printer: Archivo.TEXTMODE := TRUE; Archivo.WRITEMODE := TRUE; Archivo.OPEN(‘LPT1’); Archivo.WRITE(‘text’); Archivo.CLOSE; Where Archivo is a File variable

If you use Opos Compatible printer, you can find OCX that can give you complete control of the printer. You will have all the properties and fonction yous need to print. Even BarCode or picture, if your printer can do that. I’m using that solution with the Epson and Wincor Printers for years without problem. Yves - Alys NSP

quote:


Originally posted by ydesrumaux
If you use Opos Compatible printer, you can find OCX that can give you complete control of the printer. You will have all the properties and fonction yous need to print. Even BarCode or picture, if your printer can do that. I’m using that solution with the Epson and Wincor Printers for years without problem. Yves - Alys NSP


Sound good but could you be a little bit more specific; how to install, location of ocx, code snippet?!

quote:


Originally posted by Oxatres
I use the following code with a Zebra printer: Archivo.TEXTMODE := TRUE; Archivo.WRITEMODE := TRUE; Archivo.OPEN(‘LPT1’); Archivo.WRITE(‘text’); Archivo.CLOSE; Where Archivo is a File variable


Sounds alot easier than some OCX :slight_smile: ( OMG… if that little LPT1 trick works… I O U a beer :slight_smile: )

We are currently using it without problems… I love beer!!! :wink:

In this virtual world your beer is served… chilled and tasty :smiley: