Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-09-2007, 02:02 PM   #1
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35
Sending HP Printer Commands

On an older SCO-Unix system we have, there is a wonderful program called laserlp, which sends files to the terminal (terminal emulator's) attached VT102 printer and fits even wide-column reports into a portrait-printed page on HP printers. I Googled for this utility, and cannot find its origins, so I am thinking it came with SCO.

I have a linux-equivalent program that will send files to the attached VT100 printer

void ptr_on()

However, my attempts to turn the alter the internal codes in the HP printer have failed.

void ptr_on()
char esc_buf[6] = {0};
esc_buf[0] = (char ) 40;
esc_buf[1] = (char ) 115;
esc_buf[2] = (char ) 49;
esc_buf[3] = (char ) 50;
esc_buf[4] = (char ) 72;

printf("%c[5i", 27);
printf("%c%s", 27, esc_buf);

Has anyone written a utility that will pass print jobs to the VT102 printer and sent internal esc codes to an HP printer, and would you be willing to share your knowledge?


P.S. Here is a link to the codes I used:

Last edited by cmnorton; 12-09-2007 at 02:04 PM. Reason: Adding more information
Old 12-10-2007, 07:47 AM   #2
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
don't get exactly what you want, do you want to control the printer
or get a nice formatted text?

if you want something to format text nicely,

have a look into a2ps it is very good and even does syntax highlighting
on C code, perl etc.
Old 12-10-2007, 07:58 AM   #3
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Original Poster
Rep: Reputation: 35
More on laserlp

I want to send a report that exceeds the width of portrait to an attached (using telnet/ssh terminal emulation) terminal. In addition to sending the document to the attached printer, laserlp must be sending additional escape sequences to the HP printer, so that it prints a wide report in portrait mode, using a hardware font that will accommodate the extra width.

I don't want to "pretty up" the report. The report is formatted by Informix. I just want to send the report to that attached terminal and set the HP's internal mode.

I've narrowed the problem down. The second command <ESC>(16H is printed instead of being interpreted. I'd appreciate any help trying to figure out why the command is not being interpreted.

Last edited by cmnorton; 12-10-2007 at 02:03 PM. Reason: Add more information.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending AT commands to a SMS modem narmida Linux - Hardware 2 09-24-2009 01:05 PM
Perl: Windows sending Unix commands? PB0711 Programming 3 10-17-2006 06:48 PM
sending at commands over pppoe? sti2envy Linux - Networking 3 10-18-2005 06:35 AM
sending windows commands from linux dubman Linux - Networking 1 11-13-2003 07:34 PM
sending telnet commands non-interactively JustinHoMi Linux - Networking 4 09-29-2001 01:20 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration