18xx / ps18xx

Software for creating and running 18XX email games using Matthias Klose's postscript system.
12 stars 9 forks source link

Mac having problems in PDF creation #4

Open westerman opened 6 years ago

westerman commented 6 years ago

New to ps18xx but while I can get ps2pdf to work on ps18xx files in Linux I can not get them to work on my Mac. The exact same ps18xx-generated file gives a problem on the Mac but not Linux. A non-ps18xx PS file does not give problems on the Mac thus I think that the problem is ps18xx oriented. The error is, unfortunately, rather generic but it is consistent between different ps18xx-generated files (both MAP and overall tiles for a variant). My limited knowledge of Postscript and playing around with the PS files does not give me any obvious clues as to what is happening. I'll just use my Linux system for the moment but if anyone has a Mac or can point me in the correct direction then I would appreciate the help. The error message is:

ps2pdf P30.ps Error: /undefined in processcolors Operand stack: haveColor Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1999 1 3 %oparray_pop 1998 1 3 %oparray_pop 1982 1 3 %oparray_pop 1868 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- Dictionary stack: --dict:982/1684(ro)(G)-- --dict:0/20(G)-- --dict:91/200(L)-- --dict:112/600(L)-- Current allocation mode is local Last OS error: No such file or directory Current file position is 7696 GPL Ghostscript 9.22: Unrecoverable error, exit code 1

westerman commented 6 years ago

I should add that if I remove the processcolors section as outlined in the README in order to produce black & white images then the file gets converted to PDF without an error message. So there is something in that processcolors section that is causing a problem for the Mac.

Another point, the Mac comes with two different conversion programs -- ps2pdf (ghostscript) and pstopdf (Apple's version) -- and both have the same problem, albeit with slightly different error messages such as:

pstopdf P30.ps %%[ Error: undefined; OffendingCommand: processcolors ]%%

Stack: /haveColor

%%[ Flushing: rest of job (to end-of-file) will be ignored ]%% %%[ Warning: PostScript error. No PDF file produced. ] %% pstopdf failed on file P30.ps with error code -31000

jrebs commented 6 years ago

Hi Rick,

I haven't touched this in many moons, but I can say for certain that I was successfully playing with this package on OSX on my Macbook a handful of years ago using ps2pdf to convert the .ps files for play.

Given this fact and your other issue that I just saw pop up, I suspect both of these issues are ones introduced by the recent pull request from JC. I'd suggest that you prove or disprove that theory first by trying what you're doing against the last version of this code prior to the commits of Dec 7th 2017. This would be the fastest route to narrowing the window of where to look. I can see in his code there is a PAPERSIZE env added, so it surely explains the other issue. My hunch is it is also connected to this one.

If you can let me know the result of that test, I'll ask the author to have a look at the commits. I don't intend to work on this project any more myself (there are better non-perl projects replacing it as we speak) but unless someone wants to manage this codebase on GH themselves, I'll continue to keep an eye on these messages.

westerman commented 6 years ago

Good idea of going back however even going back to near the beginning (Jun 21, 2014) still has the same problem. So it appears to be a mismatch between what the Mac wants vs. what ps18xx is providing. Perhaps the Mac has become more strict since you developed on it.

lonerockz commented 6 years ago

I believe this has to do with "processcolors" being undefined. Perhaps this is an environment variable that is set on other operating systems?

Needless to say, I was able to get this to work with color files by commenting out (put a % in front of each line):

/haveColor glob-known not {
  /haveColor false def
  systemdict /statusdict known {
    statusdict /processcolors known {
      /haveColor processcolors 1 ne def
    } if
  } if
} if

and adding the line:

/haveColor true def

If you make this change to the 18-defs.ps it will make this change globally for all files created.

clearclaw commented 6 years ago

This is due to change (cleanup) in how Ghostview/Ghostscript handles the non-standard processcolors in statusdict. The change was supposed to be innocuous, but ps18xx trips across it. I'll get a PR submitted in a bit (I'm on the road ATM).