1. RE: printer question follow up
- Posted by Kenneth Roger <kennethroger at comcast.net> Aug 07, 2003
- 432 views
> Is it possible to print to a printer in a non > graphics/bitmap way..... Like a non windows > OS does? --george Here is an example in C. It could be translated into E for exw. // lhp.c --link with winspool.lib #include <stdio.h> #include <string.h> #include <windows.h> #include <winspool.h> char msg1[] = "usage: lhp file1 file2 .."; char prname[] = "\\\\kenneth\\hp"; char set[] = "\033E\033(s12H\033&l6d6e54F\033&a9l90M\033&k2G"; // EscE --reset // Esc(s12H --12 cpi // Esc&l6D --6 lpi // Esc&l6E --6 line top mrgn // Esc&l54F --54 lines per page // Esc&a9L --col 9 end left mrgn // Esc&a90M --col 90 begin right mrgn // Esc&k2G --lf=cr+lf, ff=cr+ff void list(FILE *p1, FILE *f1); int main(int argc, char **argv) { FILE *f1, *p1; DOC_INFO_1 di; if(argc<2) { printf("%s\n",msg1); return 0; } while(--argc) { printf(*++argv); f1=fopen(*argv,"rb"); if(f1) { OpenPrinter(prname,&p1,NULL); di.pDocName=*argv; di.pOutputFile=NULL; di.pDatatype="RAW"; if(StartDocPrinter(p1,1,&di) > 0) { StartPagePrinter(p1); list(p1,f1); printf(" is queued on %s\n",prname); EndPagePrinter(p1); EndDocPrinter(p1); } else printf("\ncan't open %s\n",prname); ClosePrinter(p1); fclose(f1); } else printf(" not found\n"); } return 0; } void list (FILE *p1, FILE *f1) { DWORD nr, nw; char buf[129], last='\0'; WritePrinter(p1,set,strlen(set),&nw); do { nr=fread(buf,1,128,f1); if(nr==0) break; buf[nr]='\0'; WritePrinter(p1,buf,nr,&nw); last=buf[nr-1]; } while(nr==128); if(last!='\f') WritePrinter(p1,"\f",2,&nw); }
2. RE: printer question follow up
- Posted by Elliott Sales de Andrade <quantum_analyst at hotmail.com> Aug 12, 2003
- 425 views
Perhaps if you print a #0C. That's a Form Feed. It's supposed to advance paper to the beginning of the next page. George Walters wrote: > > > Irv, I did what you suggested and it was really puzzling. It printed > things > fine to the printer but the first 2-3 lines of the printout that should > have > been at the top of the page were at the bottom of the page. I had no > idea > what caused this....after opening lpt am I supposed to do something else > to > position the output to the top? > > george > > ----- Original Message ----- > From: <eugtk at yahoo.com> > To: "EUforum" <EUforum at topica.com> > Sent: Thursday, August 07, 2003 5:37 PM > Subject: Re: printer question follow up > > > > --- George Walters <gwalters at sc.rr.com> wrote: > > > > > thanks, but that's way over me... i'm not a "C" > > > person... > > > > George: > > > > Perhaps I misunderstood the question - but can't you > > just print to the LPT in the same way as DOS programs > > do? Using puts() and printf()? > > > > Regards, > > Irv > > > > > > TOPICA - Start your own email discussion group. FREE! > > > > Euphoria Instant Messenger Have YOU Joined? http://groups.yahoo.com/group/euim/