Operating System - HP-UX
1833867 Members
2278 Online
110063 Solutions
New Discussion

Re: New to HPUX, need Help setting Printing Options using lp Command

 
Bert_21
Occasional Advisor

New to HPUX, need Help setting Printing Options using lp Command

I have a customer that requires I tell them the lp command options that I need for the required output. Using the printer driver I need the output to go to a file. The print width is 1000 characters and the page length I want to be 30000 lines. The resulting file will be used as input to a different system.

This is the only method the customer will allow me to use to extract the data from their system, so don't ask "why are you doing it that way".

lp -dprintername -olandscape (what else ???)

Thanks for any help.
17 REPLIES 17
Rick Garland
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

landscape printing will do 132 characters per line. If you compress you will get some more but nowhere near the 1000 characters per line you are asking.

Sounds as if you will need to make a driver to do this task.

Bert_21
Occasional Advisor

Re: New to HPUX, need Help setting Printing Options using lp Command

Create a new driver. That would be fine and acceptable. What would the command be for that?
Rick Garland
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

No command, it would be writing a driver file.
Can use a pre-existing driver file as an example to get started.
Bill Hassell
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

This is not a printer task at all. HP-UX does not use drivers like a PC. Instead, you run your data file through a simple script that can prepend and append special control sequences for HP printers. (notice I said HP printers?) -olandscape is meaningless to a non-HP-PCL printer and in your case, you're sending it to a file so there is no printer.

In PC-land, all applications make system calls in a meta-language for printer control. The Windows driver then converts this meta-language to match the capability of the printer. Nothing like this exists in HP-UX. The options like landscape and duplex are specific to certain HP printers and have no meaning to non-HP printers.

Now if you have a bunch of plain ASCII text that you wan to format to 1000 characters per line, just use the fold command as in:

fold -s -w 10000 my_file > resulting_file

As far as a page length, there is no such thing. If your target system needs some sort of code every 30000 lines to do a page eject, then a simple script can add this code.

However, I think that reading a page that is 1000 characters wide and 30,000 lines long will be extremely difficult, so perhaps the requirements have not been accurately stated. HP-UX, like any othe rflavor of Unix has no concept of line width or page length. If you can describe the source and destination data, perhaps a simpler solution can be suggested.


Bill Hassell, sysadmin
Bert_21
Occasional Advisor

Re: New to HPUX, need Help setting Printing Options using lp Command

Maybe I have not fully laid out the limitations. The printer driver is an HP Printer Driver. The reporting tool that is pulling together the data is REXX. I have very limited access to all system aspects. The only thing I can choose is a spooler option. This spooler option is based on a printer profile (HP). I am relativly sure that it is an HP Lineprinter and not a laser printer driver. With this being said I am left at the mercy of the systems manager who is requiring I come up the spooler directive that will set the output parameters, as REXX uses these metrics to determine line wrap and page eject. I want to set the parameters so far out that the line will never wrap and the page will never eject. He gave me an example:
cat - |lp -dprintername -olandscape -olpi8 -ohsi9 -oc -onb -otl63

I believe I recognize most of the commands but I can find no documentation about these options. Can you help still?
Rick Garland
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

-olpi = lines per inch
-oc = compressed
-olandscape = landscape output
-onb = no banner page
-otl = text length

I forgot hsi, I think it is dealing with height of the type
Bert_21
Occasional Advisor

Re: New to HPUX, need Help setting Printing Options using lp Command

-ohsi is the head space index
-otl text length? is this lines per page or what measurement is it using.
What is the setting for characters per line? I don't think it is cpl although it might be.
A. Clay Stephenson
Acclaimed Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

Now for the really bad news. In UNIX those options are not universal; in fact, any lp options only have meaning to the interface file that is in use. There are no drivers; output formatting is the sole responsibility of the application. It would be rather easy to modify a copy of the dumb printer interface file to simply output to a file.
If it ain't broke, I can fix that.
Rick Garland
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

hsi is the horizontal spacing
values of 0-9 in increments of #/120th inch.

tl is the text length of page
values of 0-9

If you are experimenting with the other options this text length could come in handy.

Rick Garland
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

Clay has it right. You experiment with these options based on your particular app. Some work, some don't.

Not all options are going to work with all apps.
Bill Hassell
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

And to swmplify whst I mentioned before: Those options are PCL printer options and apply ONLY to HP most printers. I say 'most' because many HP DeskJet printers and a couple of low cost LaserJet printers are not PCL compatible at all (despite more than 20 years of PCL LaserJets), but are call "Windows" printers. This means that they have no formatter, nothing to convert ABC into dots on the page. A special (and very compute-intensive) driver is needed to take Windows printer meta-data and turn it into a series of dots for the printer.

So -ohsi -olandscape -oduplex -ocompress and so on apply ONLY to HP printers. And I don't know of any HP printer that can print 1000 characters across the page (and 30,000 lines down the page) that would anything more than tiny dots. The highest resolution LaserJets can adequately print 4 to 6 point fonts (about the size of pin head) but anything more than 400-500 characters across the page are unreadable, even with a magnifying glass.

Does the 'different system' actually have a printer with these specs or is it some program that needs the special file?


Bill Hassell, sysadmin
Bert_21
Occasional Advisor

Re: New to HPUX, need Help setting Printing Options using lp Command

Bill,
Thanks for your response. But you have missed the point. Nothing is ever going to print. We are using a report writer to create a data extract. The reporting tool uses the matrix from the printer driver to format the output. We are trying to fool the report writer program so that it does not wrap the text.
I know that there are at least 100 better ways of doing this, but like I said earlier I am at the mercy of the Unix Administrator, who wants me to do his work for him. So if you have any information about option selections please let me know. It really doesn't matter if they work or not, just as long as the report writer uses them.
A. Clay Stephenson
Acclaimed Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

If you use this as an example:
"cat - |lp -dprintername -olandscape -olpi8 -ohsi9 -oc -onb -otl63"

and then tack on your statement:
"The reporting tool uses the matrix from the printer driver to format the output.",

you are then faced with a logical impossibability. The -o options are only visible to the lp command (and possibly its child processes). There is no way that the lp option settings are going to be exported to your report writer -- and any competent sysadmin would know this. Whatever formatting options needed would need to be sent to the report writer and presumably it could then select options for lp. Moreover, if you are going to use lp to output to a file then someone must create a custom interface file -- and again, the sysadmin should know this. If this were me, I would output directly to a file and then process the data as needed afterwards.

If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

Thanks for the explanation. I figured that this was just a formatting requirement and nothing to do with printing. The only thing that the lp command would do is to insert special escape sequences and ASCII control codes.

So the requirement to make the lines all 1000 characters in length is still ambiguous. Do you mean that each line from the input file should be padded with space to make it 1000 characters?

text...

Or do you mean that each line from the input be attached to the end of the previous line until you reach 1000 characters?

line1 line2 line3 line...line517 line518

And at the target program, does it understand the enf-of-line character from Unix (the LF or linefeed) or is it expecting a DOS/Windows style with 2 characters (CR+LF)? The specs are still too ambiguous to develop a working solution. One thing is for sure--you don't need to use the lp command for this task.


Bill Hassell, sysadmin
Bert_21
Occasional Advisor

Re: New to HPUX, need Help setting Printing Options using lp Command

I agree that the lp command is not the solution, however the formating options is what is needed.
The line length of 1000 characters is a maximum if less are used then the end of line is specified. The data generated from the report is held in a spool file. Another 3rd party application takes the spool file and strips all of the formating characters that were inserted by the printer driver and adds the DOS/Win CR/LF to the end of each line.
So, this whole process is just to trick the Report writer, which is a third party application that formats the output (inserting esc sequences and other formating information) based on a specified printer driver. This driver is specified within the report writer as one of its parameters.
I believe the Unix Admin is using the lp command as an example of the options that can be set for the driver.

I guess I could use the following:
lp -dmyprinter -olandscape -ocpi100 -otl30000 -onb

I understand that this is an inprobable printer capability, but if the report writer uses the values to perform it's formatting then it should work.

Do you think it makes sense?


Bill Hassell
Honored Contributor

Re: New to HPUX, need Help setting Printing Options using lp Command

Other than the CR/LF conversion, the other options won't make much sense. -olandscape (in a PCL printer script) produces the escape sequence:

ESC &l1O

(that's the escape character or hex 0x1b, followed by &, lowercase l, number 1 and UPPERCASE O) Now this has no meaning to a Postscript printer or an Epson or Lexmark or ... unless they have an HP PCL emulation module installed.

But you said that the target machine strips all formatting, why provide any printer formatting at all? I think all you need is to convert the ASCII file from Unix format (text-LF-text-LF...) to DOS/Windows format (text-CRLF-text-CRLF... and for this task, HP-UX already has the filter you need: ux2dos as in:

ux2dos file-to-convert > converted-file

Now if the target machine needs a code for the column width and page length, you'll need to find out what printers the target machine understands. I doubt very much that it knows anything about a LaserJet 9085mfp or DeskJet 9600 (or any other new HP printers). So rather than guess which options and codes might work, find out what the target program understands and just insert the need code in front of your text file (which is exactly what the lp printer scripts accomplish). Something like this:

ux2dos file-to-convert | cat my-codes - > final-file

Is this example, ux2dos converts your file, then cat first lists the contents of the my-codes file (where you put your formatting codes) and then appends the converted file. The result is then sent to the final-file. Again, the my-codes file just contains the special codes your target machine needs.


Bill Hassell, sysadmin
Bert_21
Occasional Advisor

Re: New to HPUX, need Help setting Printing Options using lp Command

Bill,
Thank you for your responses, but you just do not get the point. Of course it is meaningless, except to the report writer.

Anyway, without a clear method here, I choose a different option. I created multiple reports that fit within the 132 characters(no line wrap). Create 4 text files, and then stiched them together on my side where I have control of the data.

Thanks for all the help.