🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #3995

Re: How do I recognize postscript from a file

#3995
From: Dick Dunn
Date: Sat, 07 Nov 1992 06:55
31 lines
2027 bytes
av@uta.fi (Arto V. Viitanen) writes, in answer to suggestion to check for "%!":

>When printing from MS Windows to Postscript file, the file (if you don't
>make it not to) starts with characters ^D%! (i.e. control-D, %, !)...

Yes.  This is a bug.
A program looking for the beginning of a PostScript file should look for
^D%! - but NOT because it is right; rather, because good program design
says "be generous in what you accept, conservative in what you generate".

>...In a way,
>this is right way, since ^D means end-of-job to a Postscript printer, so
>previous job is stopped...

No, it is wrong.  An application generating PostScript has no business with
a "previous job".  Job boundaries are simply not the province of applica-
tions.

It is easy to understand why an application writer might think "well, just
to be safe, I'll generate an end-of-job marker at the beginning of the
job."  But it's not safe; more to the point it's not innocuous.  An empty
job may not be a "no-op".  Adobe has taken some pains to discourage tossing
in gratuitous ^D for some time now.

In summary: If you're trying to recognize a file containing PostScript,
look for %! or ^D%! - but you might want to complain to whoever generates
files with end-of-job at beginning-of-file that they are doing you a dis-
service and helping almost nobody.
-- 
Dick Dunn    rcd@raven.eklektix.com   -or-   raven!rcd    Boulder, Colorado
	...Simpler is better.
Technical Details
Message-ID: <1992Nov7.065504@eklektix.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!purdue!yuma!csn!raven!rcd
References: <1992Nov3.083527.20756@ugle.unit.no> <EWEINGAR.92Nov3111448@loanshark.cs.indiana.edu> <AV.92Nov4095431@kielo.uta.fi>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!purdue!yuma!csn!raven!rcd
From: rcd@raven.eklektix.com (Dick Dunn)
Subject: Re: How do I recognize postscript from a file
Message-ID: <1992Nov7.065504@eklektix.com>
Summary: applications should *NEVER* generate end-of-job ^D
Organization: eklektix - Boulder, Colorado
References: <1992Nov3.083527.20756@ugle.unit.no> <EWEINGAR.92Nov3111448@loanshark.cs.indiana.edu> <AV.92Nov4095431@kielo.uta.fi>
Date: Sat, 7 Nov 1992 06:55:04 GMT
Lines: 31