You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.4 KiB

1 month ago
  1. @echo off
  2. rem Internal batch file for calling pdfwrite driver.
  3. rem The files that call this one (ps2pdf*.bat) write the command-line
  4. rem options into _.at, and then pass the last 2 (or fewer) arguments
  5. rem to this file.
  6. call "%~dp0gssetgs.bat"
  7. echo -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE#pdfwrite >"%TEMP%\_.at"2
  8. if "%OS%"=="Windows_NT" goto nt
  9. rem Run ps2pdf on any Microsoft OS.
  10. if %1/==/ goto usage
  11. if %2/==/ goto usage
  12. rem Watcom C deletes = signs, so use # instead.
  13. rem We have to include the options twice because -I only takes effect if it
  14. rem appears before other options.
  15. :run
  16. echo -sOutputFile#%2 >>"%TEMP%\_.at"2
  17. copy /b /y "%TEMP%\_.at"2+"%TEMP%\_.at" "%TEMP%\_.at"2 >NUL
  18. echo %1 >>"%TEMP%\_.at"2
  19. %GSC% @"%TEMP%\_.at" @"%TEMP%\_.at"2
  20. goto end
  21. :usage
  22. echo Usage: ps2pdf [options...] input.[e]ps output.pdf
  23. goto end
  24. rem Run ps2pdf on Windows NT.
  25. :nt
  26. if not CMDEXTVERSION 1 goto run
  27. if %1/==/ goto ntusage
  28. if %2/==/ goto nooutfile
  29. goto run
  30. :ntusage
  31. echo Usage: ps2pdf input.ps [output.pdf]
  32. echo or: ps2pdf [options...] input.[e]ps output.pdf
  33. goto end
  34. :nooutfile
  35. rem We don't know why the circumlocution with _1 is needed....
  36. set _1=%1
  37. set _outf=%_1:.PS=.pdf%
  38. if %_1%==%_outf% goto addsuff
  39. call "%~dp0ps2pdfxx" %1 %_outf%
  40. goto postsuff
  41. :addsuff
  42. call "%~dp0ps2pdfxx" %1 %1%.pdf
  43. :postsuff
  44. set _1=
  45. set _outf=
  46. :end
  47. rem Clean up.
  48. if exist "%TEMP%\_.at" erase "%TEMP%\_.at"
  49. if exist "%TEMP%\_.at"2 erase "%TEMP%\_.at"2