Jump to content


Photo
- - - - -

How to send control sequence to HP Laserjet


15 replies to this topic

#1 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 01 February 2002 - 05:48 PM

Does anyone know how to sent control sequence to the Laserjet? I have the HP soft fonts installed
for barcode printing, for example, the PCL reset command EcE (Ec = escape), how do you code in the
statement?
Thanks

#2 Glenn Meyers

Glenn Meyers

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 221 posts
  • Gender:Male
  • Location:St. Louis, MO, United States
  • Interests:I also raise African Gray Parrots and build hot rod automobiles.

Posted 01 February 2002 - 06:09 PM

One way is to use a type 'D' for doccument function.
In the definition field you have a place to send the printer a setup code.

#3 Cheryl Lipsey

Cheryl Lipsey

    Member

  • Members
  • PipPip
  • 33 posts
  • Gender:Female
  • Location:Gainesville, FL

Posted 01 February 2002 - 06:32 PM

I am heading into a project where I need to change from 3 of 9 to regular text and back again. It has been too many years since I did this type project. Any pointers?

#4 Bill Loven

Bill Loven

    Expert

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male
  • Location:Coppell, United States

Posted 01 February 2002 - 08:34 PM

If you have an HP4SI Manual, hard to find, it has all of the sentax for PCL5. Do not use PCL6. We have been using PCL from within ProIV for some time. To Set Esc(Escape), that is the ASCI value 27.

#B = 27
$ESC = CHAR(#B)

You now have ESC in character format.

For landscape compressed printing try this.
$PCL = $ESC + '&l1O' + $ESC + '&k2S' + $ESC + '&5.467Cl12A' + $ESC + '&aoL' + $ESC + '&(8U'

This is lengthy to code so here is what we have done.

We created a file PCL_CODE
PCL_NO AK 4
PCL_DESC A 25
PCL_CODE A 100

Yous assign each type of PCL Code you would use, increment the PCL_NO by one, Describe It, and put your pcl string in PCL_CODE.

When you define your Page heading, Define the first line as $PCL_CODE Length 100, Retrieve the desired PCL_NO and set $PCL_CODE = PCL_CODE.

I normally do this with Global lscalls.

Have Fun.

#5 Guest_Anon_*

Guest_Anon_*
  • Guests

Posted 01 February 2002 - 09:26 PM

What Bill is saying (simply) is :

to get 'EcE' to reset the printer, setup a scratch variable e.g

$RESET = CHAR(27) + 'E'

Then insert $RESET within your report with length of 2 (i.e. the + E).

Obviously using this within a print will lose the print buffer, and so I wouldn't recommend it's use unless it's as a final footing!!

#6 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 01 February 2002 - 09:27 PM

Bill,
Thank you very much! That's exactly what I'm looking for. I know, to code the PCL is not a fun thing :-(.
Eric

#7 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 01 February 2002 - 09:33 PM

Anon and all,
Thank you guys!

#8 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 12 February 2002 - 12:58 AM

Hi Anon and Bill,
May I bother you guys again about how to code PCL in PROIV/Superlayer? I coded a simple report to send output to laserjet III, but the printer just printed out the PCL command along with the data.
I tried to send a simple 2 copies PCL:
the syntax is Ec&l#X, I used $DATA1 = CHAR(27) + '&l2X'
$DATA2 = $DATA1 + 'How will I make it work?'
The report prints only DATA2 and supresses the heading, no title for $DATA2.
Thank you!!!
Eric

#9 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 13 February 2002 - 06:04 PM

Hi Anon and Bill,
I'm still having problem of sending escape sequence to the laserjet, the printer just ignore it by just printing the command with the real data: I tried to send 2 copies of the report using command Ec&i#X
$COMMAND = CHAR(27) + '&L2X'
$PRINT = $COMMAND + 'How will I make it work???'

The report prints only 1 field ($PRINT).

I need to first to make sure the simple thing works, then I will try to embed the PCL commands use barcode font and then change back to the default font, whick I need help too.
Thanks a lot!!!

#10 Guest_Anon_*

Guest_Anon_*
  • Guests

Posted 14 February 2002 - 11:44 AM

Hi Eric

I have never used the multiple copies PCL command before. I believe they are used in the UNIX scripts - you can probably see this used if you hack about in /etc/lp/interface/model.orig/printqueue if your UNIX admin will allow you ;-)

If it is just a case of testing the code, try switching to bold face.

The only other thing I can think that will allow you to print multiple copies is to try putting $COMMAND as the first thing in the page heading in the report (and suppress first page, and first line for the report). Have $PRINT to just contain the text (no PCL commands). If this works, you will get 2 pages with your one line of data. Is this what you want to achieve??

#11 John Hamlin

John Hamlin

    Member

  • Members
  • PipPip
  • 10 posts
  • Gender:Male
  • Location:Costa Mesa, United States

Posted 14 February 2002 - 04:20 PM

Eric:
If you are doing all this on a Windows platform you need to map your printer directly to the port (LPT1: for example) as the Windows print drivers throw out all your escape characters. That is why your commands print and the printer does not respond to the commands. I'm able to print barcode, turning the barcode on and off within the reports, on a Windows NT system using an Intel print server to connect the printer to the system. The Intel print drivers do allow the escape sequences to get through. Mapping your printer directly to your port will also work. You will have to allow for the escape sequences when calculating your horizontal print positions. Another aspect that makes it a 'not a fun thing'. Takes lots of testing.
John H.

#12 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 14 February 2002 - 04:59 PM

Thank you John and Anon.
We are UNIX shop, we currently send barcode to SOBAR printer without any problem. This project requires sending barcodes using HP soft fonts and regular font report output, ANON suggested to have the PCL in the heading, to send a 2 copy report to the printer is just a simple test to see the laserject accepts the PCL, but if PCL has to be in the heading, then how do I tell laserjet time to switch font in the middle of the report?

#13 John Hamlin

John Hamlin

    Member

  • Members
  • PipPip
  • 10 posts
  • Gender:Male
  • Location:Costa Mesa, United States

Posted 14 February 2002 - 06:09 PM

Eric:
You should be able to go back and forth with different fonts using escape sequences within your report. Somewhere you are losing the (027) character. Be sure you are allowing enough length to the strings you are printing. It can be done. I've done it on Unix and NT.

#14 Eric Tai

Eric Tai

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Brea, United States

Posted 14 February 2002 - 08:40 PM

thans, John, I'll try again, maybe I should have used CHAR(027) instead of CHAR(27).

#15 John Hamlin

John Hamlin

    Member

  • Members
  • PipPip
  • 10 posts
  • Gender:Male
  • Location:Costa Mesa, United States

Posted 14 February 2002 - 09:30 PM

Eric:
I doubt that (027) 0r (27) is the problem. Somewhere the print driver/drivers you are using is dumping out the esc character. Sorry I can't help you more.
John H.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users