Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Lost in space AGAIN

Lost in space AGAIN

Lost in space AGAIN

Okay, here's the scoop and I'll leave it to all you experienced folks to help me out:

#1. using an HP5500dn networked printer (PCL6)

#2. need to store a *.prn overlay macro on the printer. I have the *.prn file, but not sure how to store it on the printer since it's a network and not a direct [DOS] connection, so "copy /b filename.prn" doesn't work. (If I just print it, I get all the codes printed out.)

#3. I need to call the macro for the overlay out of VB which is where I print the data for the form.

How can I do this without tearing out the rest of my hair? Any help would be GREATLY appreciated.

Been snooping for days on this info... but can't seem to find a clear explaination anywhere.

RE: Lost in space AGAIN

copy /b file.prn \\servername\printersharename

The printer has to be shared.

Have you made the macro permanent?

Let's assume the macro has an ID of 100

From your application, issue <esc>&f100y4X at the start, where the <esc> represents chr$(27) or hex 1B, and you should have your macro run on every page.

This assumes a PCL 5 output stream

Jim Asman

RE: Lost in space AGAIN

Thanks Jim, but I'm not sure that I'm getting it all....

the printer is on a tcip port and share named "LaserJet" so the command I attempted to send (through the DOS window) was:

copy /b file.prn \\\Laserjet

What I got back was an error message that; "Windows cannot find the network path. Verify that the network path is correct...  yadda yadda yadda"

I know the IP is correct, because I can ping the printer all day with no problems.... I just can't seem to get past this stumbling block.

What am I missing here?

(BTW, I greatly appreciate your help and insight.)

RE: Lost in space AGAIN

Well, the printer sits on the network alone - not connected to a printserver  or computer. It is connected only to the router the same as all the other computers.

Here's what I've got (except with about 6 more computers);

comp ======\
comp =======----  [Router]

RE: Lost in space AGAIN

Fair enough. I have several like that.

When you print to the printer from a windows application, how do you address the printer? Does it not have a local name? How does a windows app know anything about the type of printer you are pointing to?

Did you try using the IP of a computer that "knows" about the printer?

Jim Asman

RE: Lost in space AGAIN

It is simply the default printer named as "LaserJet 5500 PCL 6"

Since it is the default printer, I simply issue a; printer.print "yadda, yadda" command from VB.

RE: Lost in space AGAIN

At the time, it actually wasn't shared anywhere. I (now realizing how dumb I was) simply shared it on the same machine I'm sending from. (as Homer would say; "Doh!")

However, I guess my point is that the printer is not directly connected to any of the computers and is therefore not necessarily shared with any other computer on the network since I'm not "printing through" any computer to get to it. Nor is there a any direct printer cable linked to any of these computers, it's all done over the network.

Each computer is set up with the printer driver pointing to a standard HP tc ip port pointing to the ip address of the physical printer.

RE: Lost in space AGAIN


Share the printer. Right click on the printer icon. Click on the share tab. Click on share. Give it a share name.


copy /b file.prn \\computername\printersharename

Jim Asman

RE: Lost in space AGAIN

I did that and got the error message. But since the printer isn't connected to a computer, what in your example,would be the "computername"?

I did this:

copy /b file.prn \\\LaserJet

And got the error message when it was shared as "LaserJet"

Do I need to swap around the IP and sharename?

I'll try using this computer's name and the sharename without the ip address and let you know what happens.

RE: Lost in space AGAIN


Sent it as:

copy /b file.prn \\cmscomp\laserjet

from the DOS prompt and didn't get an error and got a "1 file copied" message... but didn't get the desired overlay either.

The PRN overlay file is approx. 838k and I don't know if it was there and wiped out when the compiled VB program went to print, - don't know if windows sends a printer reset at the start of a print job.

RE: Lost in space AGAIN

Nope.  no luck...

RE: Lost in space AGAIN

Can you tell if the printer received data?

That is, did any lights on the printer blink indicating that data was received?

If so, was the macro made permanent?

To verify the connection, send a text file and see if it prints OK.

Jim Asman

RE: Lost in space AGAIN

Yep.Lights blinked & panel read; "Processing Job"

doesn't appear that the macro is permanent... used "ovl.exe" to create the overlay from a corel draw file and the last line (after the escape char.) is: &f1s1x10x4X

does this need to be changed to read: &fNy10X

RE: Lost in space AGAIN

Was this file created using a PCL5 driver?

Assuming it was, then it looks as though the macro was made permanent with the 10x part of the final command you indicated. The 4X part of that command would enable the overlay, however, any printer reset would disable it.

You may still need a formfeed character in your application to push the sheet through.

But just for a sanity check, temporarily add a FF to the end of your macro file and copy the file to the printer.

If yyou want me to have a look at your macro file, email it to...

jlasman at telus dot net

Jim Asman

RE: Lost in space AGAIN

PCL6 driver....  I'll immediatley install a pcl5 driver and give it a try. In the meantime, i've upload the form to this link: http://dkusa.com/eng02.prn

take a look at it and let me know when you get it (so I can delete it and recover the space)

BTW, Thanks for your patience, I appreciate your understanding the frustration and appreciate your kindness

RE: Lost in space AGAIN

Just uploaded the PCL5c driver version... it is different than the PCL6 version, however I still have the same results.

RE: Lost in space AGAIN

You definitely want the PCL5 version.

It prints OK on my system.

Try this...

Copy the macro file to the printer.

Create a file called test that contains...

<esc>&f1y4X CTRL-L

copy that file to the printer and you should get your form.

Note that <esc> means the single escape character chr$(27),

and CTRL-L means the single character chr$(12)

You can remove the file from the website.

BTW, I assume that the panels are intended to be empty in the form, as they are when I print them.

Jim Asman

RE: Lost in space AGAIN

GREAT!.... got the form to print out by copying the two *.prn files! And yes, the panels get filled with data...

Which is now the problem...  

If I copy the overlay to the printer (and there are 2 forms) as permanent macro #1 and macro #2, shouldn't I be able in my application to simply "print a string" of the escape sequences to
(a) activate the macro I want,
(a1) send the data then
(a2) eject the sheet which should put it all together.

Other than the initial binary copy of the macro to store them on the printer, shouldn't I be able to do everything else directly out of my app?

I tried copying the macro in DOS... that worked,

I then started up the app that sends the data and ejects the sheet... all I got was the data and no overlay.

Using the VB command of:
printer.print chr$(27)+"&f1yf2X"
got me nothing but the command string printed on the sheet. (is this correct command string to call macro #1 and execute it?)

When (only) the form did print out sucessfully by copying the macro and then the page-ejector sample file, it printed as a DUPLEX job.... (single-sided, but it thought it was duplex)

My question is; how do I call and excute the macro(s) from within VB to have them print correctly?  Should the macro command be sent after the data?

RE: Lost in space AGAIN

Well if the command string was printed rather than being executed I would assume that the chr$(27) was filtered out or otherwise not present.

Can you direct all of this to a file so we can examine the corpse? Just your VB output should be necessary. I am reasonably confident that VB is where the problem lies.

Make sure that all the macros are permanent.

What you are trying to do is pretty trivial in a PCL context.

Jim Asman

RE: Lost in space AGAIN

I figured out part of it... the version of VB that I'm using won't let me bypass the windows drivers (easily).

Once I tested it out in a different version, I was able to successfully print out the overlay. However, the printer still thinks it's a duplex job... prints only one-sided but still runs the sheet through twice.

I'll just have to rewrite the app. (it's an old one) to a newer version.

I understand that what I'm trying to do is very trival for PCL.... it's my lack of experience/knowledge that is the tallest hurdle here and I appreciate your help.

Here's what I did:  In VB created a new project with one command button on it.
The printer I'm using is on this path: \\CMSComp\LaserJet

This code (for the command button) will print the stored macro (#1) and eject the sheet.
This does NOT work in VB3 pro --- but it DOES work in VB6:
Dim printString As String

Open "\\CMSComp\LaserJet" For Output Access Write As #1

'Call the macro (#1) and execute it
printString = Chr$(27) + "&f1y"
Print #1, printString;

'Eject the sheet.
printString = Chr$(27) + "&f1y4X" + Chr$(12)
Print #1, printString;
Close #1

RE: Lost in space AGAIN

Hang on a minute. You are getting ahead of yourself. The test file with the FF was only ever there to demonstrate that the connection was working and in a broad sense the file was taking the place of you VB application.

Macros can be called, executed, or enabled for overlay. Because a macro exists, that in itself does NOT make it an overlay.

An overlay, or more correctly an 'automatic' overlay, when enabled wth a command such as <esc>&f1y4X will be run by the printer automatically on every page just before it is ejected from the printer. No further action from the application is necessary.

A macro is called with <esc>&f###y2X where ### is the ID No.
A called macro is run by the printer immediately upon receipt of the command so the application has to keep track of the cursor to position itself before the macro is run and perhaps reposition it after.

Your general workflow would be something like this...

Download ALL pertinent macros to the printer. You could put them all into a single file if need be. You probably want to make them permanent.

Now your application comes into play. You image your user data, enable an overlay, call any other macros that are needed. When you are done with the page you may need a FF to eject the page.

If this is a multi-page output, and don't want the overlay on the 2nd page, then you would issue <esc>&f5X to disable the overlay. Once the FF for the final page has been sent, then you should end the job with a printer reset, <esc>E

It would probably be a good idea to send a reset BEFORE the download of the macro file as well.

If you don't have the PCL5 Ref. Manual, get it. You need to learn about page formatting and a bunch of other stuff. The more PCL you understand, the less you have to rely upon applications like Corel Draw to make your forms. The eng02.prn file weighs in a 900K or so, and could probably be duplicated by hand in 10K-15K. But that's later.

Jim Asman

RE: Lost in space AGAIN

Duly noted. And I can't thank you enough for your wonderful and insightful assistance. I'll get my hands on a PCL5 ref. manual asap.  I was gingerly snooping around and found this: http://docs.huihoo.com/help-pc/hw-Laserjet.html

And although I'm not a complete dunce, this might be a "quick-n-dirty reference", it certainly doesn't take the place of the real thing.

For the forms that you saw, normally there would be pre-printed versions that would be loaded in the printer and the data simply added and then printed onto them. I was almost wondering if it would be easier just to code the entire form in VB (nobody's idea of a "good time") and be done with it. That, however is the last thing I want to do, nor am I really interested in recoding the entire app.

What I don't understand is why the printer understood this as a duplex job.... Even though the backside was still blank, I didn't see anything in the file that set that parameter. It's not on the above web page (but that page is not an entire manual either.)

At least I now have a start thanks to you! I hope you don't mind if I call upon your experience if I get in another hole... I'm sure they'll be one along the way..

Thanks Jim, you're a life saver!

RE: Lost in space AGAIN

As for the duplex issue, at the start of your user data in the VB program, issue a reset <esc>E followed by a duplex off command <esc>&l0S

That is a lower case ell after the "&".

You might check the control panel on the printer itself to see if duplex has been set ON by default.

You can get a PDF of the PCL5 Tech Ref from HP. Goto www.hp.com and do a search for "PCL Reference" and that should point you to the appropriate download. The file you want is about 1.3 meg.

Good luck.

Jim Asman

RE: Lost in space AGAIN

... or see the FAQs section in this forum for details of where to obtain PCL5/PCL6/PJL documentation.

RE: Lost in space AGAIN

I have one more little question;

Above, you said;
-----------begin quote------
Your general workflow would be something like this...

Download ALL pertinent macros to the printer. You could put them all into a single file if need be. You probably want to make them permanent.

Now your application comes into play. You image your user data, enable an overlay, call any other macros that are needed. When you are done with the page you may need a FF to eject the page.
--------end quote----------

It is appearing that when I image the data from my VB app with the standard: Printer.print "yadda, yadda" that it is somehow disabling the overlay. If I simply send the overlay, then a FF (binary copy) it works fine... I get the form with no data...

Seems I can get the form OR the data... but not the two together. My question is:

Do I need to image the data strictly through PCL and bypass the VB engine and the windows printspooler?

RE: Lost in space AGAIN

You want nothing to do with the windows spooler. Assemble the data as I said before and send it directly to the printer in one stream.

Jim Asman

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close