[cups.development] Myths and Truth about `-sDEVICE=bbox` (was: Filters and rotation)

Johannes Meixner jsmeix at suse.de
Tue Jul 31 02:53:23 PDT 2012


Hello,

On Jul 29 04:17 pipitas wrote (excerpt):
> On 4/1/11 15:34, Johannes Meixner wrote:
>
>> If you can get the actual PostScript which Ghostscript gets as input
>> as a file (e.g. gs-input.ps) run Ghostscript with its "bbox" device
>> (e.g. "gs -sDEVICE=bbox gs-input.ps") to get the actual PostScript
>> bounding box values which show if the actual PostScript has
>> landscape dimensions (i.e. if it is wider than high).
>
> I think you have been fallen prey to a *VERY* common misunderstanding
> about what the "-sDEVICE=bbox" parameter *really* does:

No.
I think you confuse the actual PostScript code with DSC comments.


> * It does not print the "actual PostScript bounding box values",
>   nor does it reveal "if the actual PostScript has landscape
>   dimensions".
>
> * Instead, it renders each page and just prints the coordinates of
>   the *minimal box which contains any marking on the page* at all.

The minimal box which contains marking is exactly
what I mean with "actual PostScript bounding box values".

I do not talk about DSC comments because those can be plain wrong.


> It doesn't tell you *anything* about landscape or portrait, and
> it's not even meant to do so....

If the marked area is a square (down to a square with zero size)
it cannot tell if it is wider than high.
In all other cases it tells if it is wider than high.


If you have usual PostScript which has in a reasonable way
"filled up" the printable area on the paper (i.e. what
usually comes out of an usual application when you print
an usual document as "landscape" or "portrait" from within
the application), then "gs -sDEVICE=bbox" shows whether or not
the application had actually made its PostScript in a "landscape"
or "portrait" way.

Try out a2ps for an example where "landscape" in a2ps
actually results PostScript in "portrait":
-------------------------------------------------------------------------
$ echo portrait | a2ps -1 -o- | gs -sDEVICE=bbox -
....
%%BoundingBox: 23 23 572 815

$ echo landscape | a2ps -1 -r -o- | gs -sDEVICE=bbox -
....
%%BoundingBox: 24 23 572 819
-------------------------------------------------------------------------

If users print "a2ps -1 -r ..." output via "lp ... -o landscape ..."
they may complain that CUPS' landscape printing is broken but the
"gs -sDEVICE=bbox" test shows that the root cause is not in CUPS.

Actually the root cause is that the meaning of "landscape" in a2ps
is different compared to the meaning of "landscape" in PostScript.


Welcome to the hell of "landscape" meaning confusion!

Printing would have less issues if the word "landscape" would not exist
in the printing environment because for printing it does not make sense
(the PostScript/DSC meaning of "landscape" is only confusing).

What makes sense for printing is enforced rotation (orientation-requested)
and whether or not the marked area should fit into the printable area
(fitplot/fit-to-page).

By the way:
Options like "scale-only-down-to-fit-page" and "scale-only-up-to-fit-page"
might be nice to have?


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany
HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer





More information about the cups mailing list