I have a ps file generated from a pdf (generated from distiller (generated from a mulitple single page ps files)).
the idea here is that the product we have producing singular ps files, we then use distiller to combine them into a single pdf (optimized for resources), but we have 2 page letter that need to be printed on different stocks, so I use ghostscript to turn the pdf back into a (single) ps file.
I was then hoping to insert "<</mediaposition 1>> setpagedevice" calls to pull from different trays. I have had success with this on almost all my ps files until this ghostscript version. I have places the call after "%%PageTrailer" normally, but it does not work now.
the ghostscript ps file will read my first mediaposition call but then "ignore" the rest of them. my printer is a ricoh 2090. thanks for any help,
here is a portion of the ps file:
%!PS-Adobe-3.0
%%Pages: (atend)
%%BoundingBox: 7 16 591 785
%%HiResBoundingBox: 7.100000 16.000000 590.100000 784.800000
%.......................................
%%Creator: AFPL Ghostscript 853 (pswrite)
%%CreationDate: 2006/01/23 16:03:28
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog
% This copyright applies to everything between here and the %%EndProlog:
% Copyright (C) 2005 artofcode LLC, Benicia, CA. All rights reserved.
%%BeginResource: procset GS_pswrite_2_0_1001
/GS_pswrite_2_0_1001 80 dict dup begin
/PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch
4 index eq and{ pop pop pop}{ PageSize dup 1
5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec}
{ pop/setpagedevice where
{ pop 1 dict dup /PageSize PageSize put setpagedevice}
{ /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat
setpage}if}ifelse}ifelse}ifelse} bind def
/!{bind def}bind def/#{load def}!/N/counttomark #
/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}!
/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}!
/w/setlinewidth #/J/setlinecap #
/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat #
/m/moveto #/l/lineto #/c/rcurveto #
/p{N 2 idiv{N -2 roll rlineto}repeat}!
/P{N 0 gt{N -2 roll moveto p}if}!
/h{p closepath}!/H{P closepath}!
/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}!
/re{4 -2 roll m exch dup lx exch ly neg lx h}!
/^{3 index neg 3 index neg}!
/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}!
/q/gsave #/Q/grestore #/rf{re fill}!
/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}!
/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}!
/|{exch string readstring |=}!
/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}!
/@/currentfile #/${+ @ |}!
/B{{2 copy string{readstring pop}aload pop 4 array astore cvx
3 1 roll}repeat pop pop true}!
/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}!
/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}!
/Ic{exch Ix false 3 colorimage}!
/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>>
/CCITTFaxDecode filter}!/FX{<</EndOfBlock false F}!
/X{/ASCII85Decode filter}!/@X{@ X}!/&2{2 index 2 index}!
/@F{@ &2<<F}!/@C{@X &2 FX}!
/$X{+ @X |}!/&4{4 index 4 index}!/$F{+ @ &4<<F |}!/$C{+ @X &4 FX |}!
/IC{3 1 roll 10 dict begin 1{/ImageType/Interpolate/Decode/DataSource
/ImageMatrix/BitsPerComponent/Height/Width}{exch def}forall
currentdict end image}!
/~{@ read {pop} if}!
end readonly def
%%EndResource
/pagesave null def
%%EndProlog
%%Page: 1 1
%%BeginPageSetup
GS_pswrite_2_0_1001 begin
612 792 /letter setpagesize
/pagesave save store 197 dict begin
0.1 0.1 scale
%%EndPageSetup
gsave mark
...
cleartomark end end pagesave restore
showpage
%%PageTrailer
%%Page: 2 2
%%BeginPageSetup
GS_pswrite_2_0_1001 begin
612 792 /letter setpagesize
/pagesave save store 197 dict begin
0.1 0.1 scale
%%EndPageSetup
gsave mark
...
cleartomark end end pagesave restore
showpage
%%PageTrailer
%%Page: 3 3
...
the idea here is that the product we have producing singular ps files, we then use distiller to combine them into a single pdf (optimized for resources), but we have 2 page letter that need to be printed on different stocks, so I use ghostscript to turn the pdf back into a (single) ps file.
I was then hoping to insert "<</mediaposition 1>> setpagedevice" calls to pull from different trays. I have had success with this on almost all my ps files until this ghostscript version. I have places the call after "%%PageTrailer" normally, but it does not work now.
the ghostscript ps file will read my first mediaposition call but then "ignore" the rest of them. my printer is a ricoh 2090. thanks for any help,
here is a portion of the ps file:
%!PS-Adobe-3.0
%%Pages: (atend)
%%BoundingBox: 7 16 591 785
%%HiResBoundingBox: 7.100000 16.000000 590.100000 784.800000
%.......................................
%%Creator: AFPL Ghostscript 853 (pswrite)
%%CreationDate: 2006/01/23 16:03:28
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog
% This copyright applies to everything between here and the %%EndProlog:
% Copyright (C) 2005 artofcode LLC, Benicia, CA. All rights reserved.
%%BeginResource: procset GS_pswrite_2_0_1001
/GS_pswrite_2_0_1001 80 dict dup begin
/PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch
4 index eq and{ pop pop pop}{ PageSize dup 1
5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec}
{ pop/setpagedevice where
{ pop 1 dict dup /PageSize PageSize put setpagedevice}
{ /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat
setpage}if}ifelse}ifelse}ifelse} bind def
/!{bind def}bind def/#{load def}!/N/counttomark #
/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}!
/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}!
/w/setlinewidth #/J/setlinecap #
/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat #
/m/moveto #/l/lineto #/c/rcurveto #
/p{N 2 idiv{N -2 roll rlineto}repeat}!
/P{N 0 gt{N -2 roll moveto p}if}!
/h{p closepath}!/H{P closepath}!
/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}!
/re{4 -2 roll m exch dup lx exch ly neg lx h}!
/^{3 index neg 3 index neg}!
/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}!
/q/gsave #/Q/grestore #/rf{re fill}!
/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}!
/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}!
/|{exch string readstring |=}!
/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}!
/@/currentfile #/${+ @ |}!
/B{{2 copy string{readstring pop}aload pop 4 array astore cvx
3 1 roll}repeat pop pop true}!
/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}!
/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}!
/Ic{exch Ix false 3 colorimage}!
/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>>
/CCITTFaxDecode filter}!/FX{<</EndOfBlock false F}!
/X{/ASCII85Decode filter}!/@X{@ X}!/&2{2 index 2 index}!
/@F{@ &2<<F}!/@C{@X &2 FX}!
/$X{+ @X |}!/&4{4 index 4 index}!/$F{+ @ &4<<F |}!/$C{+ @X &4 FX |}!
/IC{3 1 roll 10 dict begin 1{/ImageType/Interpolate/Decode/DataSource
/ImageMatrix/BitsPerComponent/Height/Width}{exch def}forall
currentdict end image}!
/~{@ read {pop} if}!
end readonly def
%%EndResource
/pagesave null def
%%EndProlog
%%Page: 1 1
%%BeginPageSetup
GS_pswrite_2_0_1001 begin
612 792 /letter setpagesize
/pagesave save store 197 dict begin
0.1 0.1 scale
%%EndPageSetup
gsave mark
...
cleartomark end end pagesave restore
showpage
%%PageTrailer
%%Page: 2 2
%%BeginPageSetup
GS_pswrite_2_0_1001 begin
612 792 /letter setpagesize
/pagesave save store 197 dict begin
0.1 0.1 scale
%%EndPageSetup
gsave mark
...
cleartomark end end pagesave restore
showpage
%%PageTrailer
%%Page: 3 3
...