🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14684

how to print a string directly to a printer using "fprintf" or "printf" ?

#14684
From: Richard Yu
Date: Wed, 06 Aug 2003 18:46
37 lines
2246 bytes
don't know if this question fit the group.

I want to send a postscrip string to the printer using fprintf or printf ,
in console application, printf sends the string to screen, how can I send
them to printer ?

 I got an example :

<!--StartFragment-->
  puts("/espWL{");
  puts("  espPF setfont");
  printf("  espPL stringwidth pop dup 12 add exch  -0.5 mul %.0f add\n",
         PageWidth * 0.5f);
  puts("  1 setgray");
  printf("  dup 6 sub %.0f 3 index 20 rectfill\n", PageBottom - 2.0);
  printf("  dup 6 sub %.0f 3 index 20 rectfill\n", PageTop - 18.0);
  puts("  0 setgray");
  printf("  dup 6 sub %.0f 3 index 20 rectstroke\n", PageBottom - 2.0);
  printf("  dup 6 sub %.0f 3 index 20 rectstroke\n", PageTop - 18.0);
  printf("  dup %.0f moveto espPL show\n", PageBottom + 2.0);
  printf("  %.0f moveto espPL show\n", PageTop - 14.0);
  puts("pop");
  puts("}bind def");

another example:

fprintf(fd, "newpath\n");
fprintf(fd, "%d %d moveto\n", x, y);
fprintf(fd, "%d 0  rlineto\n", wd);
fprintf(fd, "0 %d  rlineto\n", ht);
fprintf(fd, "-%d 0 rlineto\n", wd);
fprintf(fd, "closepath\n");
fprintf(fd, "stroke\n");


, I wonder how the computer know sending the postscript string to a printer
or a screen device ?
Technical Details
Message-ID: <3f314de8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,ff83352b6b456ff2,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-06 12:11:30 PST
From: "Richard Yu" <richard@colorselector.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: how to print a string directly to a printer using "fprintf" or "printf" ?
Date: Wed, 6 Aug 2003 11:46:46 -0700
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 24.207.7.224
Message-ID: <3f314de8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1060195816 24.207.7.224 (6 Aug 2003 11:50:16 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail