[cairo] Bounding bos from ps to pdf

Francois Robert frobert at atex.com
Wed Aug 18 02:01:45 PDT 2010

> This would be a typical .ps file:
> %%BoundingBox: -54.842 -5.44374 -34.9815 10.3711 newpath
> -52.8476 -4.20964 moveto
> -53.9752 -3.93121 lineto
> -53.2801 -3.06407 moveto
> -53.9752 -3.93121 lineto
> -54.842 -4.58826 moveto
> -53.9752 -3.93121 lineto

No. This is non-DSC compliant (and possibly buggy) PS :
* %%BoundingBox: is a DSC comment (and is followed by 4 integers, not
reals). Admitedly a lot of tools out there produce a non-compliant
output. %%HiResBoundingBox: does allow reals, but it is not part
officially documented as belonging to DSC.
See Adobe specs: 
* newpath cannot be present on the comment (newline missing before
newpath ?)
* %%BoundingBox: is part of the document header which ends with
%%EndComments DSC comments (or if absent, with any non-comment line, or
with comment starting with a '%'+whitespace)

In PDF, there is no exact equivalent. There are page objects that
contain /CropBox and /MediaBox entries (possibly different for each
page), neither of which has precisely the same semantics as the PS
%%BoundingBox: comment.

More information about the cairo mailing list