LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to output the printer line by line.

I am using a dot printer lq-590hll.
When the program outputs one line of string, only one line is printed, and the next time it is output, the string is tried to be output on the next line.
Currently, when i print, one line is printed and then one page comes out.
What I want to do is print one continuous line on one page.
I would be grateful if you could tell me how to do this or if I should use a different printer.

0 Kudos
Message 1 of 4
(908 Views)

It sounds like you are using really old printing equipment.  You may have heard of ASCII (American Standard Code for Information Interchange) which uses 7 or 8-bit "characters" to print.  The first 32 characters (in hex, 0x00 to 0x1F) are called "Control Characters" because they "control" the printer or flow of information -- they aren't directly printed.  Two important control characters are 0x0D, CR (Carriage Return) and 0x0A, LF (Line Feed).  Think about a typewriter -- Carriage Return means "print the next character on the starting (usually left) edge of the paper" and Line Feed means "move the paper up one line so the next printable character will be on the next line".

 

Most "old printers" print lines of 80-100 (printable) characters.  So if you have 50 lines each having, say, 75 characters, you would print the first 75, then <CR><LF> (carriage return and line feed, to move to the beginning of the next line down the page by moving the paper up one line) and then the next 75 characters <CR><LF> and then (and so on).  Note there is another non-printing character, 0x0C, FF (Form Feed) or "page eject" that old printers use to move to the top of the next page.

 

Bob Schor

Message 2 of 4
(874 Views)

I tried printing by adding LF as you said, but one page is still printed.
I want to print line by line like an old typewriter.
I know that such a function is possible with a dot printer, but is there a way?

0 Kudos
Message 3 of 4
(828 Views)

How do you print to the printer? In old days you had a parallel port on PCs and there it was possible to access the parallel port through NI VISA. Nowadays parallel ports are something from a far away past. Typically you connect through network and there is a lot more involved to print to the printer. Typically when a program prints through the Windows GDI system it always prints an entire page, because that is what the Windows GDI system assumes.

 

There might be some possibilities but they are not trivial to implement.

 

It may be possible to connect the printer through an RS-232 port. In this way you can simply send text and commands to the printer through a serial port connection. It may also be possible to connect directly through TCP/IP to your printer if you connected it through Ethernet. If it is connected through USB, it is going to be very difficult.

 

Basically it may be possible to interface to the Windows GDI system directly and send text strings to it but that requires not only to call Windows APIs through Call Library Nodes but also very low level GDI programming to use line text output.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(819 Views)