1. printer question follow up

Is it possible to print to a printer in a non graphics/bitmap way..... Like
a non windows OS  does?

george

new topic     » topic index » view message » categorize

2. Re: printer question follow up

thanks, but that's way over me... i'm not a "C" person...

george

----- Original Message ----- 
From: "Kenneth Roger" <kennethroger at comcast.net>
To: "EUforum" <EUforum at topica.com>
Subject: RE: printer question follow up


> 
> 
> > 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);
>   }
>  
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: printer question follow up

On Thu, 7 Aug 2003 11:11:28 -0400, George Walters <gwalters at sc.rr.com>
wrote:

>
>
>Is it possible to print to a printer in a non graphics/bitmap way..... =
Like
>a non windows OS  does?

f=3Dopen("lpt1","wb")
puts(f,"...") etc,
close(f)

Pete

new topic     » goto parent     » topic index » view message » categorize

4. 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

new topic     » goto parent     » topic index » view message » categorize

5. Re: printer question follow up

well, maybe it's just that simple, the demo's seem'd to be bit map
approaches. i'll give that a try.

thanks

george

----- Original Message -----
From: <eugtk at yahoo.com>
To: "EUforum" <EUforum at topica.com>
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!
>
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: printer question follow up

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>
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!
>
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: printer question follow up

--- George Walters <gwalters at sc.rr.com> 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?

By printing directly to the printer you now have to
deal 
with the peculiarities of each printer brand. Remember

the "escape codes" which were often different for
different 
brands and even different models of the same brand?

You'll probably have to dig up some manuals, and find 
a reset or clear-the-buffer or top-of-page code to
send 
to the  printer. Perhaps also some codes to set the
margins, fonts (if available), etc. etc.

Then when your client changes printers, do it all over

again. Printing is one area where Windows is actually 
a big improvement over what we had before.  

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu