|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Printing with Ghostscript: Migrating from PostScript to PDF as input formatHi,
I am currently working on replacing PostScript by PDF as standard print job format. Now I ran into the following situation: The Ghostscript source tarball contains the PPD files cups/pxlcolor.ppd and cups/pxlmono.ppd. These PPD contain options to control Ghostscript's built-in PCL-XL driver ("pxlcolor"/"pxlmono"). All controls are performed by inserting PostScript code of the form << ... >> setpagedevice into the PostScript input data stream. Now the question is how to control the "pxlmono" and "pxlcolor" drivers when the input data stream is PDF. AFAIK embedding of PostScript code is not possible. Would be great if it is possible. Please tell me what is really the case. On IRC there was a suggestion to send the "<< ... >> setpagedevice" at first to Ghostscript and after that the PDF file. Either via gs -f commands.ps -f job.pdf or gs -c "command1" -c "command2" ... -f job.pdf I tried the second version using the following command line (taken from the cups/pstopxl filter and the cups/pxlmono.ppd): --------------------------------------------------------------------------- gs -dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOMEDIAATTRS -sDEVICE=pxlmono -sstdout=%stderr -sOutputFile=foo.pxl -c "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" -c "<</MediaPosition 5>>setpagedevice" -c "<</HWResolution[600 600]>>setpagedevice" -c "<</Duplex false>>setpagedevice" -f ~/walking-map-portland-1.pdf --------------------------------------------------------------------------- Sending only the PostScript commands (omitting "-f ...") gives no error. If I use the full command line as shown I get: --------------------------------------------------------------------------- Error: /undefined in --setpagedevice-- Operand stack: --nostringval-- --dict:10/10(L)-- --dict:39/39(ro)(L)-- --dict:1/1(L)-- Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1905 1 3 %oparray_pop 1904 1 3 %oparray_pop 1888 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- 1873 4 8 %oparray_pop --nostringval-- Dictionary stack: --dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:97/200(L)-- --dict:97/200(L)-- --dict:106/127(ro)(G)-- --dict:276/300(ro)(G)-- --dict:21/25(L)-- --dict:3/5(L)-- Current allocation mode is local GPL Ghostscript 8.63: Unrecoverable error, exit code 1 --------------------------------------------------------------------------- Is this idea prinicpally feasable? Or is there a way to control Ghostscript's built-in drivers completely by the command line? How do I "translate" the PostScript instructions from the PPDs to command line options for use with both PostScript and PDF as input (so that I can adapt the option entries in the Foomatic database). Thank you very much in advance for any help. Till _______________________________________________ gs-devel mailing list gs-devel@... http://www.ghostscript.com/mailman/listinfo/gs-devel |
|
|
Re: Printing with Ghostscript: Migrating from PostScript to PDF as input formatTill Kamppeter wrote:
> Hi, > > I am currently working on replacing PostScript by PDF as standard print > job format. Now I ran into the following situation: > > The Ghostscript source tarball contains the PPD files cups/pxlcolor.ppd > and cups/pxlmono.ppd. These PPD contain options to control Ghostscript's > built-in PCL-XL driver ("pxlcolor"/"pxlmono"). All controls are > performed by inserting PostScript code of the form > > << ... >> setpagedevice > > into the PostScript input data stream. Now the question is how to > control the "pxlmono" and "pxlcolor" drivers when the input data stream > is PDF. AFAIK embedding of PostScript code is not possible. Would be > great if it is possible. Please tell me what is really the case. > > On IRC there was a suggestion to send the "<< ... >> setpagedevice" at > first to Ghostscript and after that the PDF file. Either via > > gs -f commands.ps -f job.pdf > > or > > gs -c "command1" -c "command2" ... -f job.pdf > > I tried the second version using the following command line (taken from > the cups/pstopxl filter and the cups/pxlmono.ppd): > > --------------------------------------------------------------------------- > gs -dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOMEDIAATTRS > -sDEVICE=pxlmono -sstdout=%stderr -sOutputFile=foo.pxl -c > "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" -c > "<</MediaPosition 5>>setpagedevice" -c "<</HWResolution[600 > 600]>>setpagedevice" -c "<</Duplex false>>setpagedevice" -f > ~/walking-map-portland-1.pdf > --------------------------------------------------------------------------- > > Sending only the PostScript commands (omitting "-f ...") gives no error. > If I use the full command line as shown I get: > > --------------------------------------------------------------------------- > Error: /undefined in --setpagedevice-- > Operand stack: > --nostringval-- --dict:10/10(L)-- --dict:39/39(ro)(L)-- > --dict:1/1(L)-- > Execution stack: > %interp_exit .runexec2 --nostringval-- --nostringval-- > --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- > --nostringval-- false 1 %stopped_push 1905 1 3 > %oparray_pop 1904 1 3 %oparray_pop 1888 1 3 %oparray_pop > --nostringval-- --nostringval-- 2 1 1 --nostringval-- > %for_pos_int_continue --nostringval-- --nostringval-- 1873 4 8 > %oparray_pop --nostringval-- > Dictionary stack: > --dict:1155/1684(ro)(G)-- --dict:1/20(G)-- --dict:97/200(L)-- > --dict:97/200(L)-- --dict:106/127(ro)(G)-- --dict:276/300(ro)(G)-- > --dict:21/25(L)-- --dict:3/5(L)-- > Current allocation mode is local > GPL Ghostscript 8.63: Unrecoverable error, exit code 1 > --------------------------------------------------------------------------- > > Is this idea prinicpally feasable? Or is there a way to control > Ghostscript's built-in drivers completely by the command line? How do I > "translate" the PostScript instructions from the PPDs to command line > options for use with both PostScript and PDF as input (so that I can > adapt the option entries in the Foomatic database). > > Thank you very much in advance for any help. > > Till > The problem with the error I have solved now, "-dNOMEDIAATTRS" has to be left out. This option seems to be incompatible with the "pxlmono" driver. Now I have tried to change the values of the PostScript options and tried to actually print the output. The PageSize, InputSlot, and Duplex options do not modify the output, only the Resolution option does. So the the PDF seems to reset PageSize, InputSlot, and Duplex. Is there some other way to control the settings of GhostScript drivers when the input is PDF? Till _______________________________________________ gs-devel mailing list gs-devel@... http://www.ghostscript.com/mailman/listinfo/gs-devel |
|
|
Re: Re: Printing with Ghostscript: Migrating from PostScript to PDF as input formatOn 13 Aug 2008 at 23:22, Till Kamppeter wrote:
> Now I have tried to change the values of the PostScript options and > tried to actually print the output. The PageSize, InputSlot, and Duplex > options do not modify the output, only the Resolution option does. So > the the PDF seems to reset PageSize, InputSlot, and Duplex. > > Is there some other way to control the settings of GhostScript drivers > when the input is PDF? To prevent the page size being changed for each PDF or PS page, in GSview I use the following: fprintf(optfile, "-c \042<< /Policies << /PageSize %d >> /PageSize [%d %d] ", (fixed_media == 1) ? 5 : 3, widthpt, heightpt); fprintf(optfile, "/InputAttributes currentpagedevice \ /InputAttributes get mark exch {1 index /Priority eq not \ {pop << /PageSize [%d %d] >>} if } forall >> \ >> setpagedevice\042 -f\n", widthpt, heightpt); } Otherwise you need to redefine printing of pdfshowpage in pdf_main.ps, so that it uses a different implementation of pdfshowpage_setpage. When Artifex move the PDF interpreter from PS code to C code, this may change. Russell Lang gsview@... Ghostgum Software Pty Ltd http://www.ghostgum.com.au/ _______________________________________________ gs-devel mailing list gs-devel@... http://www.ghostscript.com/mailman/listinfo/gs-devel |
| Free Forum Powered by Nabble | Forum Help |