Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lost in space AGAIN

Status
Not open for further replies.

CStaley

Programmer
Dec 14, 2007
20
0
0
US
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.


 
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?)

ALSO;
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?
 
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
 
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
----------------------
 
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
 
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:
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!
 
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 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
 
... or see the FAQs section in this forum for details of where to obtain PCL5/PCL6/PJL documentation.
 
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top