Is it possible to get argv[0] in postscript?

前端 未结 1 2005
失恋的感觉
失恋的感觉 2021-01-24 07:24

I was wondering if it is possible to get argv[0] in postscript.

For example, I want to be able to print the postscript file\'s name.

If I name the postscript f

相关标签:
1条回答
  • 2021-01-24 07:52

    This is not possible with Postscript in general. Many postscript environments, like in a printer, will not have a filesystem or filenames at all. A file in the general sense is just an abstraction for accessing a sequence of bytes one at a time.

    The Ghostscript interpreter implements an extension which may enable you to do what you want.

    <file> .filename <string> true
    <file> .filename false
    If the file was opened by the file or .tempfile operator, returns the file name and true; if the file is a filter, returns false.

    Ghostscript and the PostScript language


    But a much more common thing to do would be to generate the postscript output from another program. It then would probably be better to identify the source file, since the postscript might conceivably be generated on the fly and transmitted without needing to exist on disk.

    Or for simpler purposes, define the filename in a string at the very top of the program so it's easy to find if you ever want to change it.

    %!
    /thisfile (myfilename.ps) def
    
    0 讨论(0)
提交回复
热议问题