Search code examples
postscript

Is it possible to access the name of a postscript file via the file itself?


Let's say I have a postscript file named "filename.ps". Is it possible to get "filename.ps" as a string within the file?


Solution

  • Conceptually PostScript is not delivered by file, its a stream which may arrive via a variety of means. Usually a PostScript interpreter is running on a printer, and so the PostScript may arrive via a serial interface (eg USB), network, etc. There may be no file involved at any point. All of the delivery mechanisms simply pass the PostScript program to the interpreter, the interpreter (usually) has no idea what the source of the data is.

    So there is no definitive specified way to get the name of the file being executed (if there is one). Various PostScript interpreters may let you do so, but there is no one solution for all.