Search code examples
filenamespostscript

How do I get the name of Postscript file object?


Using Postscript, I want to retrieve the name of the file being executed. I know that I can get the file object using 'currentfile', but how do I get its name?

I want to include the name in the document.

Thanks.


Solution

  • Ghostscript has a .filename operator that'll do it. No idea about the portability. Tiny viewable example:

    /Times-Roman findfont
    12 scalefont
    setfont
    newpath
    100 200 moveto
    currentfile .filename pop show