LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-09-2007, 02:02 PM   #1
cmnorton
Member
 
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()
{
printf("%c[5i",27);
}

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?

tnx
cmn

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

http://www.dragon-it.co.uk/links/hp_pcl_codes.htm

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

Rep: Reputation: 239Reputation: 239Reputation: 239
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
cmnorton
Member
 
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.
 
  


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:17 PM.

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