[cups] setting margins when printing a ps (postscript) file

Istvan Gabor suseuser04 at freemail.hu
Wed Feb 18 10:03:51 PST 2015


Thank you for answering.

Johannes Meixner írta:
>
>Hello,
>
>On Feb 17 21:26 Istvan Gabor wrote (excerpt):
>> cups 1.5.3 in openSUSE 12.2
>> I have a (proprietary) program which generates ps (postscript) file
>> output and sends it to cups to print it out. I can not affect in any
>> way what comes out from the program.
>
>But you can modify in any way as you like what the CUPS filtering
>does with that PostScript, see
>https://en.opensuse.org/SDB:Using_Your_Own_Filters_to_Print_with_CUPS
>

Yes, I have read this. Based on section "Adding Additional Filter Stages to the Default CUPS Filter System" I tried to create an additional filter and insert it before the cups filters. As printing the pdf file is correct I thought I could make a ps2pdf filter.
What I did:

I added a line to /usr/share/cups/mime/mime.types:

application/postscript-prefiltered

I edited /usr/share/cups/mime/mime.convs:

I changed  the line 

application/postscript		application/vnd.cups-postscript	66	pstops

to

application/postscript 		application/postscript-prefiltered 10	PsPrefilter

and I added a new line below this one:

application/postscript-prefiltered application/vnd.cups-postscript 66	pdftops

I also made a PsPrefilter file in /usr/lib/cups/filter directory.

What I don't know what to write exactly in the PsPrefilter file.
I tried

#! /bin/bash

ps2pdf -sPAPERSIZE=a4

but it did not work. I don't know how to write the script.

Could you please give hint?

Thanks,

Istvan




More information about the cups mailing list