Article 7026 of unix-pc.general: >From: jlw@lzga.ATT.COM (Joe Wood) Newsgroups: unix-pc.general Subject: Re: problems printing with lp and IBM Laser Message-ID: <1927@lzga.ATT.COM> Date: 1 Jun 90 23:21:45 GMT References: <1899@novavax.UUCP> Distribution: unix-pc Organization: AT&T BL Middletown/Lincroft NJ USA Lines: 151 In article <1899@novavax.UUCP> rwright@novavax.UUCP (Ronald K. Wright) writes: >I have to buy stuff on state contract, which is why I have an IBM >laser, working in HP laserjet mode. I am using a 3.51m os, with >development set on a 2meg, 40 meg 3B1. > > >I need to print some pr filename | lp stuff. What I get is page one >with header and then a second page with out header but with 10 lines >of text at the top and then the header for page two. >I can make it turn out ok if I use pr -l51 filename | lp , but it wastes >a lot of paper and is fair ugly. > Ah, yes, I remember it well. In any event I remember it. I had this problem when I first got my HPLaserJet and ran it on my UNIX-PC. The problem arises because of a difference in the number of lines on the page that the device driver uses and how many lines per page the print engine can handle. pr and lp without modification think in terms of 66 lpp. The Canon engine in the HPLaserJet can only handle 60 in 10 pt. Courier. I am really hazy about this since I have since converted to a Postscript brains in my HPLaserJet making it into a PSJet+M so it's been a while. The place in the docs to look for information is in LP(7) under the discussion of LPRGET and LPRSET ioctl's. I wrote a little program to set and chack tha values which needs to be run at every re-boot. I also seem to remember a provided program which came with 3.51 so you can see how long ago I'm talking about. Unfortunately I don't have my 3.51 release notes here with me right now. I have appended the program source for my little program. I think that you still will be stuck with pr -l60 or some such. Sorry. "Go PostScript, Young Man." Joe Wood jlw@lzga.ATT.COM --------------------8<---------cut-here-----------8<----------------------- /* * * lpset - Set line printer device settings * * SYNOPSIS * lpset [-s] [-l #] [-c #] [-i #] * * DESCRIPTION * Lpset sets the line printer indent, -i option, * columns, -c option, and lines/page, -l option. * The -s option supresses printing. Any option * not mentioned is not changed; therefore, lpset * alone reports the existing settings. Options can * be in any order and either -optionnumber or * -option number. * */ #include #include #include #include #define DEVICE "/dev/lp" #define tell( word, struct_mem, number ) \ if( number != -1 ) {\ if( !silent )\ fprintf(stderr, "Setting %s to %d\n",\ word, number);\ struct_mem = number;\ } char *prognam; main(argc, argv) int argc; char *argv[]; { struct lprio lpset; int fd; short silent, indent, cols, lines; int c; extern int optind; extern int errno; prognam = argv[0]; if( (fd=open(DEVICE, O_WRONLY)) < 0 ){ fprintf(stderr, "%s: Cannot open %s; reason = %d", prognam, DEVICE, errno); exit(fd); }; indent = -1; cols = -1; lines = -1; silent = 0; while( (c = getopt(argc, argv, "si:c:l:")) != EOF ){ switch( c ){ case 's': silent = 1; break; case 'i': indent = thsarg( 132 ); break; case 'c': cols = thsarg( 132 ); break; case 'l': lines = thsarg( 66 ); break; default: exit(-1); } } ioctl(fd, LPRGET, &lpset); if( !silent ) fprintf(stderr, "Indent = %d\nColumns = %d\nLines/Page = %d\n", lpset.ind, lpset.col, lpset.line); tell( "Indent", lpset.ind, indent ); tell( "Columns", lpset.col, cols ); tell( "Lines/Page", lpset.line, lines ); if( (indent != -1) || (cols != -1) || (lines != -1) ) ioctl(fd, LPRSET, &lpset); exit(0); } int thsarg( lim ) int lim; { char *p, c; extern char *optarg; int value; value = atoi( optarg ); p = optarg; while((c = *p++)) if( (!isdigit(c)) && (c != '+') && (c != '-') ){ fprintf( stderr, "%s: Non-Numeric Argument - %s\n", prognam, optarg); exit(-1); } if( value < 0 || value > lim ){ fprintf( stderr, "%s: Value out of range - %d\n", prognam, value ); exit(-1); } return value; }