eps - open in postscript file fails -
executing following code
%!ps-adobe-2.0 % /bdf { bind def } bind def /ldf { load def } bdf % /cm { 28.3464566929134 mul } bdf /icm { 28.3464566929134 div } bdf % /helvetica findfont 20 scalefont setfont % /filespec (c:\\test1\\test2\\test3\\logo.eps) def % filespec status { 4{pop}repeat (exists! \n) print gsave 2.0 cm 25.0 cm translate 0 0 moveto {filespec (r) file}stopped{ (ups!? not exit! \n)print }{ dup cvx exec closefile }ifelse grestore }{ (does not exit! \n)print }ifelse stroke showpage i receice this:
gpl ghostscript 9.06 (2012-08-08) copyright (c) 2012 artifex software, inc. rights reserved. software comes no warranty: see file public details. displaying non dsc file c:/__edb__/test/zwi.ps loading nimbussanl-regu font %rom%resource/font/nimbussanl-regu... 3486280 2151039 3424632 2124503 2 done. exits! ups!? not exit!? ok, have done deeper investigation:
working "gsview 5.0 2012-01-17" fails (double click on zwi.ps).
working "gpl ghostscript 9.06 (2012-08-08)" ok; logo (command line).
i working 64 bit windows 7.
thanks all.
i'm assuming using windows because of file specification, ghostscript doesn't need -dnosafer except in special circumstances.
nosafer prevents safer being applied, nosafer intended use during ghostscript's own startup routines allow access own files (it can't start otherwise). in general should never use nosafer.
i don't see why channel output not inline other ghostscript output, executing ghostscript command line, or inside application ?
the real problem because 'file' returns error, assuming file not exist. fallacious. file may exist, permissions may prevent ghostscript opening file reading. file may have permissions prevent this, or may os file, or file may open in application denies sharing.
you can use code supplied luser droog above show error occurred, or not execute 'file' in stopped context, in order recover error. rather 'undefinedfilename' (caused file not existing) expect 'invalidfileaccess'.
note postscript program has error if file not exist:
filespec status { ... }{ pop (does not exit! \n)print }ifelse if file not exist status returns single boolean on stack, value 'false', consumed ifelse. means stack empty , when 'else' clause executes 'pop' stackunderflow error.
Comments
Post a Comment