vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Folks, I'm trying to help an AIX 5.1 customer to direct some of his print to a 'mailbox' (reserved disk space for up to 100 users) on a Canon printer, using lpr. The command would be '@PJL COMMENT CANPJL SET MAILBOXNUMBER= (0-99)'. The administrator isn't sure how to put this before or even in the print stream, and he is using smitty to set up his printers. The only other alternative I can think of is to direct the print to a 'wintel box' and use the printer banner to call the PJL. Any and all advice appreciated ! gordonmc -- --------------------------------------------------------------------- "Eliminate annoying spam! My mailbox is protected by iHateSpam, the #1-rated spam buster." http://www.ihatespam.net |
| |||
| "Gordon McInerney" <gordonmc@snet.net> wrote in message news:<6Llyc.25201$Hy3.21359@newssvr31.news.prodigy .com>... > Folks, .... > The administrator isn't sure how to put this before or even in the > print stream, and he is using smitty to set up his printers. > Hi, we are looking for a solution to this issue as well. We have a Sharp multifunction copier and need to inject PJL codes into the print job to select the proper output tray. We have tried various HP drivers on the RS6000 without success. Based on my linux experience, I believe a filter needs to be applied that will include the command IN the print job, as this is where the printer is getting it's config info. If you find a solution elsewhere would you be so kind as to post it as a follow-up to this message? I will do the same. L8kr |
| ||||
| On 16 Jun 2004, Laker Netman wrote: > "Gordon McInerney" <gordonmc@snet.net> wrote in message news:<6Llyc.25201$Hy3.21359@newssvr31.news.prodigy .com>... > > Folks, > ... > > The administrator isn't sure how to put this before or even in the > > print stream, and he is using smitty to set up his printers. > > > > Hi, we are looking for a solution to this issue as well. We have a > Sharp multifunction copier and need to inject PJL codes into the print > job to select the proper output tray. We have tried various HP > drivers on the RS6000 without success. Based on my linux experience, > I believe a filter needs to be applied that will include the command > IN the print job, as this is where the printer is getting it's config > info. If you find a solution elsewhere would you be so kind as to > post it as a follow-up to this message? I will do the same. > > L8kr > > Here is a program that we use to insert PJL codes into print jobs being sent to a plotter. /* plotdr2.c */ /* ** Backend program for HP DesignJet 755CM plotter ** ** - the name of the file to be processed is passed to this program as ** its last argument ** ** - places a label consisting of the submitting user's id at the ** beginning of each plot ** ** Installation procedure ** ** xlc -c -DAIX plotdr2.c ** xlc -o plotdr2 -lqb plotdr2.o ** cp plotdr2 /usr/local/bin */ #include <stdio.h> #include <string.h> #include <sys/file.h> #include <sys/stat.h> #include <IN/standard.h> #include <IN/backend.h> #include <time.h> int main(int argc, char *argv[ ]) { time_t now; /* area for timestamp for log file records */ char crrdt[26]; char *logfile = "/var/adm/plotdr2log"; FILE *lfp; struct stat stbuf; char *get_from(); /* subroutine to obtain submitting userid */ char fname[1025]; /* name of file being processed */ char uid[100]; /* id of user who submitted file */ int uidlen; int input; char buf[BUFSIZ]; int pdone; /* keep track of amount of file processed */ int pdone_last = -1; long fsize; long amtread = 0; int i,j,n; int wrc; /*.e*/ /* control records to be written to the plotter */ char *startjob = "\x1b%-12345X@PJL JOB NAME = \"Test\"\n\r"; char *enthpgl2 = "@PJL ENTER LANGUAGE = HPGL2\n\r"; char *discutter = "EC1"; /* disable automatic cutter */ char *selectpen = "SP1"; char *lablineinit = "LB \n\n\n\n\n\r\x03"; char labline[100]; /* to contain label line with userid filled in */ char *pginst = "PG"; char *entpjl = "\x1b%-12345X"; char *reenthpgl2 = "\x1b%-12345X@PJL ENTER LANGUAGE = HPGL2\n\r"; char *enlcutter = "EC"; /* enable automatic cutter */ char *endjob = "\x1b%-12345X@PJL EOJ NAME = \"Test\"\n\r"; /*.e*/ strcpy(labline,lablineinit); /* initialize label line */ lfp = fopen(logfile,"a"); /* prepare to append to log file */ now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n\n%s",crrdt); fprintf(lfp,"plotdr2 entered\n"); if (argc <= 1) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"no file specified\n"); fclose(lfp); exit(EXITOK); } log_init(); /* tell qdaemon processing started */ strcpy(uid,get_from()); now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"uid=%s\n",uid); uidlen = strlen(uid); if (uidlen > 8) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"userid too long\n"); fclose(lfp); exit(EXITOK); } j = 3; /* insert userid into label line */ for (i=0; i<uidlen; i++) { labline[j] = toupper(uid[i]); j += 2; } if (strlen(argv[argc-1])>1024) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"file name too long\n"); fclose(lfp); exit(EXITOK); } strcpy(fname,argv[argc-1]); now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"file name = %s\n",fname); if (stat(fname, &stbuf) == -1) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"unable to check file status\n"); fclose(lfp); exit(EXITOK); } fsize = stbuf.st_size / 100; now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"file size = %i\n",fsize); /*.e*/ input = open(fname, O_RDONLY, 0); if (input == -1) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"unable to open file\n"); fclose(lfp); exit(EXITOK); } /* write commands to the plotter */ fputs(startjob, stdout); /* start job */ fputs(enthpgl2, stdout); /* enter HP-GL2 */ fputs(discutter, stdout); /* disable automatic cutter */ fputs(selectpen, stdout); /* select pen */ fputs(labline, stdout); /* write label */ fputs(pginst, stdout); /* end of page */ fputs(entpjl, stdout); /* enter PJL */ fflush(stdout); /* send commands */ while (1) /* send user's file to the plotter */ { n = read(input, buf, BUFSIZ); if (n == -1) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"error reading file\n"); fclose(lfp); close(input); exit(EXITOK); } if (n == 0) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"file read successfully\n"); close(input); break; } amtread += n; wrc = write(1, buf, n); if (wrc != n) { now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"error writing output\n"); fclose(lfp); close(input); break; } pdone = amtread / fsize; /* compute percentage of file done */ if (pdone != pdone_last) { if (pdone < 100) { log_percent(pdone); /* tell qdaemon percentage done */ pdone_last = pdone; } } } /*.e*/ fflush(stdout); /* make sure all of file sent to plotter */ /* write commands to the plotter */ fputs(reenthpgl2, stdout); /* re-enter HP-GL2 */ fputs(enlcutter, stdout); /* enable automatic cutter */ fputs(endjob, stdout); /* end job */ fflush(stdout); /* send commands */ now = time(0); strcpy(crrdt,ctime(&now)); fprintf(lfp,"\n%s",crrdt); fprintf(lfp,"plotdr2 exiting\n"); fclose(lfp); /* close log file */ log_percent(100); /* tell qdaemon processing completed */ return EXITOK; } -Peter Ferrara, AIX Administrator, University of Rhode Island Ferrara@URI.Edu |