g3post 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/rc
  2. # convert CCITT G3 Fax format to PostScript
  3. if (! ~ $DEBUG '') flag x +
  4. PATCH='%%Patch from lp'
  5. switch ($LPCLASS) {
  6. case *hp4simx*;
  7. PATCH=$PATCH'
  8. %% set the default papertray to be the lower tray for HP4siMX printers
  9. statusdict begin defaultpapertray end 1 ne {
  10. statusdict begin
  11. 1 setdefaultpapertray
  12. end
  13. } if'
  14. }
  15. for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
  16. switch ($i) {
  17. case -P*;
  18. case man manual manualfeed;
  19. PATCH=$PATCH'
  20. %%BeginFeature: *Select ManualFeed
  21. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  22. << /ManualFeed true >> setpagedevice
  23. } {statusdict begin /manualfeed true def end} ifelse
  24. } stopped cleartomark
  25. %%EndFeature'
  26. case simplex;
  27. DUPLEX=0
  28. case [0-9];
  29. PATCH=$PATCH'
  30. %%BeginFeature: *Select InputTray
  31. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  32. << '$i' << /MediaType (tray'$i') >> >>
  33. << /MediaType (tray'$i') >> setpagedevice
  34. } {statusdict begin '$i' setpapertray end} ifelse
  35. } stopped cleartomark
  36. %%EndFeature'
  37. case 11x17 [Ll]edger;
  38. PATCH=$PATCH'
  39. %%BeginFeature: *Select Ledger
  40. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  41. << /PageSize [792 1224] >> setpagedevice
  42. } {statusdict begin '$i'tray end} ifelse
  43. } stopped cleartomark
  44. %%EndFeature'
  45. case transparency vg viewgraph;
  46. PATCH=$PATCH'
  47. %%BeginFeature: *Select Transparency
  48. [{ << /MediaType (Transparency) >> setpagedevice
  49. } stopped cleartomark
  50. %%EndFeature'
  51. case *;
  52. echo illegal option ''''-i $i'''' >[1=2]
  53. }
  54. }
  55. if (! ~ $#DUPLEX 0) {
  56. switch ($DUPLEX) {
  57. case 0;
  58. DUPLEX=false
  59. case 1;
  60. DUPLEX=true
  61. }
  62. PATCH=$PATCH'
  63. %%BeginFeature: *Set DuplexMode
  64. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  65. << /Duplex '$DUPLEX' >> setpagedevice
  66. } {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
  67. } stopped cleartomark
  68. %%EndFeature'
  69. }
  70. PATCH=$PATCH'
  71. %%EndPatch from lp'
  72. if (! ~ $PATCH '' -P*)
  73. PATCH=-P$PATCH;
  74. if (~ $MAG '') MAG=1
  75. if (~ $MAG [.0-9]*) MAG=-m^$MAG^,^`{echo $MAG '*' 2 | hoc}
  76. if (! ~ $LAND '') LAND=-L
  77. if not LAND=()
  78. /$cputype/bin/aux/g3p9bit |
  79. /$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH |
  80. $LPLIB/process/hpost
  81. exit