Operating System - OpenVMS
1830741 Members
2229 Online
110015 Solutions
New Discussion

How to print a background logo/picture

 
SOLVED
Go to solution
mike_695
Advisor

How to print a background logo/picture

How to print a background picture / logo on a formatted report ?

We use HPLJ5SI and standard VMS Print symbiont UCX$LPD_SMB.

Environment:

VMS 7.1 on VAX 4500

TIA,

Mike
27 REPLIES 27
Jan van den Ende
Honored Contributor

Re: How to print a background logo/picture

Mike,

I am sorry, but with LPD the only option you got is a M$ / *UX type of construct.

You will have to pre-process your to-be-printed, such that the result is one single file that contains all that is to be "printed", including all steering info (control strings).

If you want to use the VMS technique of printing, using queue and/or print paramaeters such as a PAGE_SETUP module, then the only way to do that on network-connected printers is by using the UCX$TELNETSYM (TCPIP$TELNETSYM starting VMS 7.2).

If you do that, then you create a .TXT file with whatever you want on that page (including the formatting controls to get it correct! )
Now you put that module in the text-library for your queue.
($ SHOW QUE xx/FULL -- to show which library;
$ HELP LIBR -- for the exact syntax to insert).
Then,
$ DEFINE FORM /PAGE_SETUP= [any other setup params]

Now, print/FORM= or will do the trick.
or
INIT /QUEU .. /DEFAULT=FORM= ;
which uses this form for any print command not explicitly specifying another form

-----

Why can you only do this on TELNETSYM, and not on LPD?

Well, VMS uses (and has always used) the concept of printJOB.
A job consists of a number of related files.
M$ and *UX do not recognise the JOB concept.
Each file is considered to be independant.
And in that view, any setup or reset module is a separate file, so, a separate job, so, each time reset printer and skip to next page.

TELNETSYM (as seen from the printer) opens an "interactive" telnet session, and writes all kind of things to the output port. After the VMS queue considers the --JOB-- done, only then is the "telnet" session session disconnected, and control is given back to the printers' internal logic.

Hope this helps,

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Ian Miller.
Honored Contributor

Re: How to print a background logo/picture

you can use a relay queue to do the formatting (as described above) then pass the result to the lpd queue.
____________________
Purely Personal Opinion
Ian Miller.
Honored Contributor

Re: How to print a background logo/picture

Also check the lpd printcap fields for the version of ucx you are using because there may be a limited way you can specify a form ( and therefore a setup module).

An alternative would be to use DCPS to print to the printer this may allow a greater range of options.
____________________
Purely Personal Opinion
Doug Phillips
Trusted Contributor

Re: How to print a background logo/picture

Mike,

If your printer has enough memory, load your logo/picture as a macro at the beginning of the job and then call the macro at each page. This saves a lot of network bandwidth. See the PCL manual for the actual commands.

-Doug
mike_695
Advisor

Re: How to print a background logo/picture

Doug,

Your idea about pre-loading a logo into a printer memory and then use MACRO calls sounds interesting.

What PCL manual you are refering to ?
Can you give me some pointers/example to get me started ?

TIA,

Mike
Jan van den Ende
Honored Contributor

Re: How to print a background logo/picture

Mike,

about time to combine the good of the above ideas:

Use Doug's printer-loaded Macro,

Use Ian's Relay Queue to be able to use VMS print functonality,

Use my /FORM setup in Ian's queue, and in the form specifying module, supply the control strings that call the Macro.

... and now it is up to you to fill in the details and do the actual coding and debugging.

Please DO report here how things turn out!

Success.

Proost.

Have one on me.

Jan

Don't rust yours pelled jacker to fine doll missed aches.
Robert Atkinson
Respected Contributor

Re: How to print a background logo/picture

I've also heard the use of stored macros being banded about over the years, but nobody has ever given any specifics.

Is there any chance someone can write a complete description on how this is acheived from a VMS system?

Rob.
Bojan Nemec
Honored Contributor

Re: How to print a background logo/picture

Maybe, the PCL reference manual will be in support for this question. Here is the link:

http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13210/bpl13210.pdf

Look at the Macros chapter. There is also an example how to create a letterhead macro.
You can write such a macro and make it permanent or create a temporary macro at the begining of the job with:
$ DEFINE/FORM/SETUP= ...
where macrodefinition is a library module with the macro definition.

Then in the /PAGE_SETUP just add a module which calls (call,execute or overlay - please read the specification in the manual) the macro at the beginning of each page.

Bojan
Robert Atkinson
Respected Contributor

Re: How to print a background logo/picture

Brojan,
I've had a read of that manual, and it all seems fairly straight forward.

It would still be useful to have this translated into the real world, with some real examples.

For instance, how can the original overlay be created (MS Word?) and how do we go about getting it stored as a macro?

Robert.
labadie_1
Honored Contributor

Re: How to print a background logo/picture

Use Dcps as I suppose your printer will be supported by Dcps.
Look at the file in the DCPS$LAYUP directory. There should be a file called
CONFIDENTIAL.PS. Look at it.
Doug Phillips
Trusted Contributor

Re: How to print a background logo/picture

Easiest way to setup a macro: Use a Windows program, like Paint, to get your image printing correctly to paper. Then, Print it to a File and get it to the VMS system. Now, how you do this next part depends on the nature of the file you've just created and what tools you have to work with. You could write a simple little program or use an editor that doesn't have a buffer limit.

You need to add and remove some escape sequences. The example in the manual creates macro#1.

To the begining of your file, add:
&f1y0X
(27 38 102 49 121 48 88)

This is equivalent to the &f1Y&f0X shown in the manual, and you can use that instead if you don't trust combined commands;)

From the end of the file, remove the and everything following it, usually an E reset (12 27 69).

Then, to the end add:
&f1X
(27 38 102 49 88)

Now, you might need to do some other things, like cursor positioning, but it depends on your macro. Read the differences between Execute, Call and Overlay.

Bojan gave the link to the manual and he and others have explained the VMS part. PCL and printer stuff is discussed over in the Printer->Software forum where the printer gurus hang out.

HTH
Doug
mike_695
Advisor

Re: How to print a background logo/picture

Doug,

I've tried your approach, but encountered some problems:

- I used MS Paint to load/display the original little logo (was in JPEG format).
I've printed the image to a file and transfered this to VAX all right.
I managed to print this to a VAX print queue (UCX$LPD).

I've checked/open this file with a Notepad and it is PJL Postscript file (there is no FF there).

The problem is that this little logo prints out as ONE whole page on VAX.
In other words I can't put the necessary text report on the SAME page.

Also, I need to position this little logo in the upper right corner.

In short, how do I combine my PCL escape sequences with a logo (in PJL Postricpt format) to print everything on one page ?

TIA,

Mike
Bojan Nemec
Honored Contributor

Re: How to print a background logo/picture

Mike,

Try to check what is in the file. The only method I know is to take the manual and reinterpret each PCL command. Try to delete all PCL commands that are not needed. The picture commands is probably something like this:

*t#R - set resolution # is number of dots per inch
*r#T - raster height # is the height
*r#S - raster width
*r#A - start graphics # is 1 or 0
*b#W... - transfer raster data # is number of bytes
probably there are many *b#W commands
*rC - end raster graphics

When you extract only the picture you can position it (see the macro example in the manual). Try to put the &f0S (push cursor) yust after the &f1y0X (see dougs post) and &f1S (pop cursor) at the end just before &f1X. This is because the cursor position is not saved when you call the macro. If this dont work you can position the cursor at the begining of the page using the position command (see manual).

Bojan
mike_695
Advisor

Re: How to print a background logo/picture

Bojan,

Unfortunately, as you can see from the attachment (using Notepad), this is actually POSTSCRIPT format.
In other words, there are no PCL commands.
It obviously prints as a whole page and I don't know how to force my text/report on the same page.
I'm fairly familiar with PCL commands, but not with Postscript.

Would you know how to "tell" the printer not to eject the page after printing this logo (which is in the Postscript format) and to position itself at the beginning of the same page in order to let me print the report ?

Is there an easy way to convert a JPEG image to RASTER format ?

TIA Mike
Bojan Nemec
Honored Contributor

Re: How to print a background logo/picture

Mike,

I am also not familiar with postscript.

You can try to install a laserjet printer on yours M$ machine and print to file. One other method is to use ghostscript to convert postscript to PCL. I try this with the file you attached in the previous post. Now I am at home and have only a Linux system on hands but you can get ghostscript also for Windows and VMS.

The ghostscript command was:
gs -sDEVICE=laserjet -sPAPERSIZE=legal -sOutputFile=t.pcl t.ps

(t.ps is yours file without starting and ending PCL commands).

I try to arange the file as you say (the logo is printed at the right top corner of the page). On my home DeskJet prints OK, but I can not print text at the beginning of the page, so I move the cursor after the logo. Maybe this will work on a PCL5 machine (DeskJet is PCL3) try to play with &a0h540V command at the end of the attachment. On the DeskJet I also cant try the macro function (not supported) but I add the macro commands at the begining and end of the file.

Bojan
mike_695
Advisor

Re: How to print a background logo/picture

Bojan,

We are making some progress here now - Thank you !

My immediate problem now is to find/install a postscript-to-pcl converter for Windows.

The downloaded ScriptLogic does not quite work well on my Windows 2000 or XP workstation. I believe, I need to download some extra Scriptlogic drivers (perhaps PCL3)!?

Pozdrav,

Iskra Delta janicmx@yahoo.com
Bojan Nemec
Honored Contributor

Re: How to print a background logo/picture

Mike,

You can try with ghostscript (its GPL or AFPL):

http://www.cs.wisc.edu/~ghost/

for direct download:

https://sourceforge.net/project/showfiles.php?group_id=1897&package_id=108733&release_id=270066

If you want to run ghostscript on VMS the distribution is on the freeware CD:

http://h71000.www7.hp.com/openvms/freeware/index.html

Abbout PCL3, I dont know if macros are implemented int this PCL version. In PCL5 are.

Bojan
Doug Phillips
Trusted Contributor

Re: How to print a background logo/picture

Mike,

When you print the image to a file, print to a non-postscript HP LJ. Apparently, the printer driver you used was a postscript one.

-Doug
mike_695
Advisor

Re: How to print a background logo/picture

Bojan, Doug and others,

I'm almost there - thank you !
Yes, I followed your advise and installed local PCL printer (HP 1200 PCL) on my XP.
Now, when I print my logo (in the attachment) to a file on an XP workstation, I get a PCL file which I can ftp to VAX and print it all right.

However, I have a problem adding my PCL control sequences to the file.

Actually, a mere opening of this PCL file with NOTEPAD and saving it back WITHOUT ANY CHANGES messes up the printout.
I tried this several times.

Notepad is not supposed to add anything, yet the mere opening and saving the file back changes something !?

All I want is to postion the cursor BELOW the logo to get it ready for the report.

Any ideas / help ?

TIA,

Mike
Jan van den Ende
Honored Contributor

Re: How to print a background logo/picture

Mike,

no guarantees, but MY first try would be to ftp (image) this file to VMS.
Also, create a file with just the cursor positioning, and then $ APPEND the latter to the former.
That "SHOULD" leave the LOGO file intact...

Success,

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Bojan Nemec
Honored Contributor

Re: How to print a background logo/picture

Mike,

I will never trust M$ Notepad. Notepad changes the contents of the file (know something about this when editing files with slovenian characters).
Jans APPEND is a good idea, but looking at yours attachement you should remove the starting and also the ending PJL commands (%-12345X) and maybe some other @PJL commands.

So you need a better editor, which does that you want and not that he means that is correct ;)
The file in my previous post was edited on linux with the emacs editor.

Try to copy the file on VMS and edit it with the tpu editor.

Bojan
Robert Atkinson
Respected Contributor

Re: How to print a background logo/picture

UltraEdit is one of the best for Windows. Lets you work in Hex as well.

Rob.
Doug Phillips
Trusted Contributor

Re: How to print a background logo/picture

TPU probably won't work with the .prn file because the file is stream and too large for the buffer.

I knew a guy once who could do things like this with TECO, but I can't. I think there's an emacs editor on the VMS freeware CD.

If this is something that will be done often, write a simple little program to open the file for input in block mode and an output file in stream. Find the first E, then output the define macro - start macro sequences, and output everything else in the file up to the . Then, output the stop macro command and whatever else you need at the end. &f4X is the command to enable the macro for automatic overlay. If you do that, you'll need to either delete or disable the macro at end-of-job.

-Doug
Ian Miller.
Honored Contributor

Re: How to print a background logo/picture

TECO - An editor for real programmers :-)
A What-You-Get-Is-What-You-Deserve sort of editor.
See for example
http://www.ibiblio.org/pub/academic/computer-science/history/pdp-11/teco/

It is possible to edit binary files with teco!

There is at least one member of VMS Engineering who is a fan. I don't remember many commands (FS is the find and subtitute command) but the fastest way of converting a file from streamLF to vanilla rms text file is
EDIT/TECO file.xxx
EX$$

($$ is escape escape).

(now lost in nostagic thoughts of twenty years go when I could write teco macros that worked! :-)
____________________
Purely Personal Opinion