- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Escape sequence to print proper font from unix
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 06:18 AM
тАО08-23-2005 06:18 AM
how do I do use this and get it to always print in line printer mode from unix?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 06:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 06:40 AM
тАО08-23-2005 06:40 AM
Re: Escape sequence to print proper font from unix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 06:42 AM
тАО08-23-2005 06:42 AM
Re: Escape sequence to print proper font from unix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 09:12 AM
тАО08-23-2005 09:12 AM
Re: Escape sequence to print proper font from unix
Getting you the right answer will require defining how the printer is connected. Does this printer have a JetDirect interface card? If so, did you use hppi to connect it to the lp spooler? If so, then to print landscape and compressed mode, simply use these options:
lp -dmyprinter -olandscape -oc /etc/profile
To get a page of available options, you can add the option: -ooptions as in:
lp -dmyprinter -olandscape -oc -ooptions /etc/profile
Now the old jetadmin software is obsolete (has been for more than 5 years) so if your older is running 10.10 or 10.20, upgrade to hppi and delete the remote printer and add it back with hppi.
If your older machine is pre-10.00, then you're stuck with jetadmin. Just add the printer normally and override the printer script with a generic printer model such as PCL5. You'll have lots of options available which can be listed with the -ooptions option.
For hppi, there are man pages for the printer scripts with more details than the options page. Try man net_ljx000
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 09:25 AM
тАО08-23-2005 09:25 AM
Re: Escape sequence to print proper font from unix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 09:27 AM
тАО08-23-2005 09:27 AM
Re: Escape sequence to print proper font from unix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 01:21 PM
тАО08-23-2005 01:21 PM
Re: Escape sequence to print proper font from unix
Now it is critical to understand the difference between proportional and fixed fonts. In all those font choices from the printer's selftest, more than 75% of these fonts are proportional and that means that you can put 500 i's on a single line but only 100 W's because W is much wider than i in a proportional font. So choosing font number 11 may produce a mess for your report because the data doesn't line up. So before you choose font 11 from the font test page, test it with a simple script. We could use vi to create the test file but putting escape sequences into a text file is somewhat advanced. So put this into a file:
#!/usr/bin/sh
export PATH=/usr/bin
ESC="\033"
FONT11="${ESC}(10U${ESC}(s0p16.67h8.5v0s0b0T"
echo "$FONT11\c"
echo "1234567890"
echo "iiiiiiiiii"
echo "mmmmmmmmmm"
To test this script, just send it to your printer with the command:
sh ./myscript | lp -dlj2820
Now I tried this on a couple of HP printers and it indeed produces a small, fixed spacing font (which is what you want) so this escape sequence should work for you.
Now the question is how to insert this string in front of your reports. I am going to assume that your program is of no use in customizing the reports (ie, being able to specify setup strings) so you'll need to create another print queue using the 'dumb' model script. I recommend the dumb script since you don't want all the complexity of a full net_ljx000 script. And yes, you can create multiple print queues for the same printer. In this way, the standard queue gives you all the net_ljx000 options while the custom queue always prints with the specified font and no other options.
So create another print queue with hppi and specify the dumb script. For hppi, select any printer number from the list (or accept the one automatically chosen). We'll change it later. Select the first option to rename the ridiclous default print queue name, then save the changes and select 0 (zero) to create the queue. Verify that it works with the lp command.
Now replace the current model script with the dumb script by copying it from the model directory. Assuming your printer was called lpsmall:
cp /usr/lib/lp/model/dumb /etc/lp/interface/model.orig/lpsmall
Then cd to the model.orig directory and edit the lpsmall script. First, search for the word banner. You should see banner="yes", so change this to banner=""
Now search for the word cat and you will see: cat "$file" 2>&1. Insert this line ABOVE the cat line:
echo "\033(10U\033(s0p16.67h8.5v0s0b0T\c"
Now save this file and test it by printing something like this:
lp -dlpsmall /etc/profile
That should select font 11 and print quite small. And to anticipate your next question, the spacing between lines (or lines per page) can be controlled too. Many report generators are stuck in prehistoric line printer mode and count lines to control spacing to the next page. So if your report does not position the top of the next page correctly (it 'creeps' up or down with each additional page, you must adjust the lines per inch. Add two more lines after the echo line above like this:
VSI=4.0
echo "\033&l${VSI}C\c
Now VSI=4.0 selects 12 lines per inch. The units of measure for VSI are 1/48th of an inch. If the report is too long and spills over onto the next page, make VSI smaller, perhaps VSI=3.85. If the length of the report is too short, make VSI larger as in VSI=4.37. In all cases, you can edit the printer script, save it and then immediately print to test the results.
Here is what your new script will have at the cat line:
for file in $files
do
echo "\033(10U\033(s0p16.67h8.5v0s0b0T\c"
VSI=4.0
echo "\033&l${VSI}C\c
cat "$file" 2>&1
done
Bill Hassell, sysadmin