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

Helge Blischke helgeblischke at web.de
Mon Feb 23 09:50:33 PST 2015


As for a special filter for this weird type of PostScript:
–	Define a special document type like
	application/flexys-postscript		string(0,%!) + contains(0,512,“%%Creator: /FLEXYS/)

–	Define a conversion role like
	application/flexys-postscript		application/postscript	30	flexystops

–	Set up a filter, flexystops (as shell- or Perl- or Python- or whatever script) which
	inserts the
	<</BeginPage {pop -24 0 translate}>>setpagedevice
	just after the 
	%%BeginSetup
	comment.

Note that the document type name does not conform strictly to the mime rules, but
it is necessary that this is checked by cupsd prior to application/postscript (the mime types
are sorted alphabetically!).

Now, a more basic note concerning the bad trick using the ps to pdf loopway:
I think it is completely unacceptable that different conversion routes all of which implement
standard format conversions lead to different printouts. I strongly recommend to file
a bug „to whom it may concern“ (I do not know the details of the configuration, so I 
cannot be more precise).

> Am 23.02.2015 um 14:35 schrieb Johannes Meixner <jsmeix at suse.de>:
> 
> 
> Hello,
> 
> On Feb 19 16:07 Helge Blischke wrote (excerpt):
>> the following PPD modification will settle the issue (tested):
> ...
>> insert the line:
>> 
>> *JobPatchFile 1: "<</BeginPage {pop -24 0 translate}>>setpagedevice"
>> 
>> and revert to the original imageable area line.
>> 
>> This will every rendered line shift 24 points to the left (adjust
>> the ?24? to your real needs).
> 
> But this translates every PostScript input for this print queue
> and not only the problematic PostScript from Istvan Gabor's
> proprietary program.
> 
> In contrast if ps2pdf or ps2ps somehow "magically" makes the
> problematic PostScript print o.k. it should not change the
> printout of any other PostScript.
> 
> 
>> That your PDF workaround really works on your system is,
>> I think, a design bug in the pdftopdf filter
> 
> There is no pdftopdf filter in openSUSE 12.2 with CUPS 1.5.3.
> 
> The pdftopdf filter is provided by cups-filters.
> 
> But openSUSE 12.2 with CUPS 1.5.3 uses the traditional
> PostScript workflow where PDF gets converted to PostScript
> by the traditional CUPS filter /usr/lib/cups/filter/pdftops
> that is provided by CUPS <= 1.5.4.
> 
> The traditional CUPS filter /usr/lib/cups/filter/pdftops is
> only a wrapper that calls the system's "pdftops" executable
> /usr/bin/pdftops which is provided by the poppler-tools RPM:
> -------------------------------------------------------------------
> # echo Hello | a2ps -1 -o- | ps2pdf - - | lp -d testy
> [stdin (plain): 1 page on 1 sheet]
> [Total: 1 page on 1 sheet] sent to the standard output
> request id is testy-48 (0 file(s))
> 
> # grep PID /var/log/cups/error_log
> I [23/Feb/2015:14:17:51 +0100] [Job 48]
> Started filter /usr/lib/cups/filter/pdftops (PID 6801)
> D [23/Feb/2015:14:17:51 +0100] [Job 48]
> Started filter pdftops (PID 6802)
> D [23/Feb/2015:14:17:51 +0100] [Job 48]
> Started filter pstops (PID 6803)
> D [23/Feb/2015:14:17:51 +0100] [Job 48]
> PID 6803 (pstops) exited with no errors.
> D [23/Feb/2015:14:17:51 +0100] [Job 48]
> PID 6802 (pdftops) exited with no errors.
> D [23/Feb/2015:14:17:51 +0100]
> PID 6801 (/usr/lib/cups/filter/pdftops) exited with no errors.
> -------------------------------------------------------------------
> Note the two 'pdftops' processes.
> PID 6801 /usr/lib/cups/filter/pdftops calls
> pdftops (PID 6802) where the latter is /usr/bin/pdftops.
> 
> The pstree output looks like this:
> -------------------------------------------------------------------
> |-cupsd -f
> | `-pdftops 58 root (stdin) 1 finishings=3 number-up=1 ...
> |   |-pdftops -level2 -origpagesizes /var/spool/cups/d00051-001 -
> |   `-pstops 58 root (stdin) 1 finishings=3 number-up=1 ...
> -------------------------------------------------------------------
> 
> Perhaps the '-origpagesizes' is the crucial thing here.
> "man pdftops" reads:
> -------------------------------------------------------------------
> -paper size
>   Set the paper size to one of "letter", "legal", "A4", or "A3".
>   This can also be set to "match", which will set the paper size
>   of each page to match the size specified in the PDF file.
>   If none the -paper, -paperw, or -paperh options are spoecified
>   the default is to match the paper size.
> 
> -paperw size
>   Set the paper width, in points.
> 
> -paperh size
>   Set the paper height, in points.
> 
> -origpagesizes
>   This option is the same as "-paper match".
> -------------------------------------------------------------------
> 
> 
>> How the ImateableArea line from the PPD modifies the trim box,
>> I could not determine; I suspect that is due to a SuSE specific
>> patch.
> 
> In openSUSE 13.2 where cups-filters exist, there is not any patch.
> We provide cups-filters "as is" from upstream.
> 
> But even in openSUSE 13.2 the default is still CUPS 1.5.4
> with its traditional PostScript workflow.
> 
> Experienced users who like it can manually switch
> to the PDF workflow with cups-filters and optionally
> also to CUPS 1.7.5 or CUPS 2.0.2 as they like it.
> The RPMs are available from the openSUSE build service
> development project "Printing":
> https://build.opensuse.org/project/show/Printing
> 
> 
> Kind Regards
> Johannes Meixner
> -- 
> SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild,
> Dilip Upmanyu, Graham Norton - HRB 21284 (AG Nuernberg)
> 
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://www.cups.org/mailman/listinfo/cups




More information about the cups mailing list