Line Printer - Need Help to Print Lines


Hi Everyone,

I have a project where I need to print one line at a time to an OkiData Microline form printer, every x minutes. In order to not print a whole form and print multiple statuses on the same sheet. This is a law in some states for the product that we are producing.

The printer will be connected to the PC that is running PAC Display via USB. As of right now I have the printer and PC configured so that I can print single lines using the following command from the windows command line:

ECHO Hello World!>PRN

or from Matlab:

fid = fopen(‘LPT1:’,‘wt’);
fprintf(fid,‘Hello World!’

How could I do the same thing from Opto 22 PAC Display?

(Note: the answer I received from support does not solve my issue. I need to send a line to a LPT printer automatically, not have the user click and not send graphics)

Answer from Support:

It is possible to send the window you are on or screen to a printer in PAC Display. There are few ways doing it. It’s not similar to the Matlab code mentioned in your email. It is also possible to send configured ‘Alarms’ to a printer after an even occurred or you want to create a little print object on the screen so you can press and print the screen.

Also, here’s some forum info on printing that might be helpful:

Hers manual for PAC Display:

Best Regards,




Welcome to the forums.

Take a look at page 253 and 273 of the Pac Display Users Guide (form 1702).
It will show how to print alarm status automatically to a printer with no user intervention.
If you set up your alarm points and PAC Display carefully, you should find that you can simply print the exact format you require because you will be printing from your strategy [I]via [/I]PAC Display.



I’ve also heard one of our coworkers hooked a serial printer directly to a PAC controller, for complete control of the printing. Let me know if you’d like me to find out more details on that.


Yes please! If you could refer us to your coworker or get us started in the right direction, we’d really appreciate it.


Hi surprisetalk,

Welcome to the OptoForums! Often the trickiest part of communicating from a PAC to another device is figuring out what that other device wants to see. Does your serial printer have a good, detailed manual that tells what characters to send to it to make it print? Baud rates, that stuff?

On the PAC Control side, you’d use a Communication Handle variable, configuring it for the appropriate baud rate, parity, etc. Then “transmit” the appropriate characters.

Here’s an example of using a comm handle to do serial communication: (click here).

What’s your application? Just curious.



Thank you so much, OptoMary!

We use our Opto for manufacturing; we intend on hooking it up to a label printer so that we can put barcodes and various information on certain items we make :slight_smile:

You definitely started us in the right direction! If we make any progress, we’ll post it for others’ benefit


Thanks for all of your help.

To solve this I did the following:

1.) Set up the line printer as a “networked printer” and used the “ECHO” command to print to it
2.) Created text file that I wanted to print
3.) Created a *.bat file that I used to parse through and “ECHO” each line to the line printer

I have attached a link to a *.pdf showing how I got the printer setup to work.




Nice work!! like it…