Article View: comp.lang.postscript
Article #44Re: Printing straight ASCII text on a postscript printer?
From: Robert Rogers
Date: Wed, 28 Oct 1992 16:34
Date: Wed, 28 Oct 1992 16:34
162 lines
6661 bytes
6661 bytes
In article <1992Oct19.150910.21666@iplmail.orl.mmc.com> steveg@iplmail.orl.mmc.com (Steve Gabrilowitz) writes:
> I just purchased a QMS model PS-810 and am having a heck of a time
> setting it up to do what I want, this difficulty is compounded to the
> power of 2 by the fact that the darned thing didn't come with a manual
> ;-(
>
> There's a switch on the back that sets various modes, I set it in BATCH
> and if I send a .ps file to the printer it works nicely but if I send a
> regular text file it never prints. I found a bunch of programs that
> convert an ASCII file to postscript and they seem to work OK (this is
> on a MS-DOS machine BTW), but none of them quite solve my problem
> because I want to be able to use programs that send text output
> straight to the printer but not have to change the switch setting on
> the machine when printing a postscript file. I figured to solve the
> problem by setting up 2 different print queues on my Lantastic network
> - one that would just pass the information and the other that would
> send some "magic" command to put the printer into text mode first.
> Herein lies the reason why these programs I mentioned earlier won't
> work for me - even though some of them are designed to be used as a
> filter Lantastic won't let me install a filter on a queue, all I get is
> a file that is to be sent to the printer before a print job and a file
> to be sent after the print job. I got hold of a little postscript
> program that is supposed to put the printer into some sort of TTY
> emulation mode but it doesn't seem to work.
>
> Does anybody have any idea how to do what I want (or for that matter,
> is it possible?)
>
> All help appreciated!!!!!!!
# full page non-cute .sig deleted!
Take this and stick it at the head of your text file.
Semi-klugy, but it does the trick. Made by the Master of PS, Glenn.
I put a space at the start of every line to stop some mailers from
barfing. You might want to take it out before using.
Courier 11 pt will fit perfect as a standard ASCII font.
-----------CUT HERE ------------------
%!-Adobe-1.0
%%Title: printfile.ps
%%Creator: Glenn Reid, Adobe Systems Incorporated
%%CreationDate: Tue Apr 22 15:35:53 1986
%%Pages: 0
%% Copyright (c) 1986 Glenn Reid and Adobe Systems Incorporated.
%% Use it, distribute it (with this message), but don't sell it.
%%
%% This program will take miscellaneous text concatenated at its
%% end and print it in some default font. It is designed to be
%% minimal in its functionality, but flexible enough to be easily
%% adapted to other uses.
/pagenumber false def
/in. {72 mul} def
/line 512 string def % for input line buffering
/buff 10 string def % for page number conversion
%% CHANGE THESE IF YOU LIKE
%% If any of these parameters are defined ahead of this file, then
%% those values will be used. A typical way to use this is to
%% allow an application to redefine some of the parameters by
%% inserting definitions ahead of this file in the print stream.
%% Examples of redefinitions look like:
%%
%% /fontname /Palatino-Roman def
%% /pointsize /13 def
%% /header (document.ps) def
%% /pagenumber false def
%% /leftmargin 36 def
%%
%% Any number (including 0) of these parameters may be defined to
%% be different from the defaults. The defaults are quite
%% reasonable for general use, and will print in 11-point Courier
%% with a 12-point Courier-Bold header (only prints a header if
%% /header string is defined by the user). Margins top, left and
%% bottom are: .75 in., .75 in., and .5 in.
%%
%% Otherwise, the following defaults will be used:
/leftmargin where not
{ /leftmargin .75 in. def } {pop} ifelse
/bottom where not
{ /bottom .5 in. def } {pop} ifelse
/startX where not
{ /startX leftmargin def } {pop} ifelse
/startY where not
{ /startY 10 in. def } {pop} ifelse
/fontname where not
{ /fontname /Courier def } {pop} ifelse
/pointsize where not
{ /pointsize 11 def } {pop} ifelse
/leading where not
{ /leading pointsize 2 add def } {pop} ifelse
/headerfontname where not
{ /headerfontname /Courier-Bold def } {pop} ifelse
/headerpointsize where not
{ /headerpointsize 12 def } {pop} ifelse
/headerfont
headerfontname findfont headerpointsize scalefont
def
/page where not
{ /page 1 def } {pop} ifelse
/pagenumber where not
{ /pagenumber true def } {pop} ifelse
% This routine will print a header at the top of each page
/printheader {
gsave
currentdict /header known {
36 10.5 in. moveto
headerfont setfont
header show
} if
pagenumber {
8 in. 10.5 in. moveto
headerfont setfont
page buff cvs show
/page page 1 add def
} if
grestore
startX startY moveto
} bind def
/crlf {
leftmargin currentpoint exch pop % replace X with leftmargin
leading sub
dup bottom le
{ pop pop showpage printheader }
{ moveto } ifelse
} bind def
/printfile {
line readline % read a line from the file
{ % 'if' procedure body (+boolean)
{ % 'while' procedure body
show crlf % show what's left by readline
currentfile cvlit % use as operand
line readline % and read the next line
not {exit} if % exit if no more input to be had
} loop % end of while-proc
} if
showpage % when input file is exhausted
} bind def % /printfile
fontname findfont pointsize scalefont setfont
printheader % execute header
currentfile cvlit % uses rest of this file as input
% everything following 'PrintFile' is treated as data, through EOF
printfile
--------------CUT HERE--------------
--
======================================================================
Robert Rogers -- Boulder Creek CA, USA, Earth, Sol system, Milky Way
= Internet: rob@netcom.com or uunet!netcom.com!rob
= AOL: MacGun = GEnie: R.ROGERS10
= CIS: 73377,1017
Technical Details
Message-ID:
<1992Oct28.163415.27679@netcom.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!usenet.coe.montana.edu!decwrl!decwrl!netcomsv!netcom.com!robReferences:
<1992Oct19.150910.21666@iplmail.orl.mmc.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!usenet.coe.montana.edu!decwrl!decwrl!netcomsv!netcom.com!rob From: rob@netcom.com (Robert Rogers) Newsgroups: comp.lang.postscript Subject: Re: Printing straight ASCII text on a postscript printer? Message-ID: <1992Oct28.163415.27679@netcom.com> Date: 28 Oct 92 16:34:15 GMT Article-I.D.: netcom.1992Oct28.163415.27679 References: <1992Oct19.150910.21666@iplmail.orl.mmc.com> Organization: Netcom - Online Communication Services (408 241-9760 guest) Lines: 162