sanjaykumar81
sanjaykumar81

Reputation: 445

Ghostscript BoundingBox pdfinfo -box vs gs -sDevice=bbox

I will to know the difference between BoundingBox information which is out of commands pdfinfo -box and gs -sDevice=bbox.

pdfinfo -boxoutput :

  $pdfinfo -box tempCmykPdfFile.pdf
  Producer:       GPL Ghostscript 9.20
  CreationDate:   Tue Mar  7 09:48:56 2017
  ModDate:        Tue Mar  7 09:48:56 2017
  Tagged:         no
  Pages:          1
  Encrypted:      no
  Page size:      212.6 x 113.39 pts
  MediaBox:           0.00     0.00   212.60   113.39
  CropBox:            0.00     0.00   212.60   113.39
  BleedBox:           0.00     0.00   212.60   113.39
  TrimBox:            0.00     0.00   212.60   113.39
  ArtBox:             0.00     0.00   212.60   113.39
  File size:      20886 bytes
  Optimized:      no
  PDF version:    1.5

While gs -sDevice=bbox output:

 $gs -sDevice=bbox tempCmykPdfFile.pdf
 GPL Ghostscript 9.20 (2016-09-26)
 Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
 This software comes with NO WARRANTY: see the file PUBLIC for details.
 Processing pages 1 through 1.
 Page 1
 %%BoundingBox: 13 48 199 100
 %%HiResBoundingBox: 13.986000 48.181006 198.435017 99.220989

BoundingBox information is different in both the case and I am not to figure out the why. Could anyone kindly help me to understand the difference.

Thanks.

Upvotes: 2

Views: 1315

Answers (2)

U. Windl
U. Windl

Reputation: 4401

It seems your file set the page size (maybe even to wrong values), not the bounding box (crop box in PDF). For a PDF file using DIN A4 papersize and [/CropBox [36 36 468 513] /PAGES pdfmark, I got:

Page size:       432 x 477 pts
Page rot:        0
MediaBox:            0.00     0.00   595.00   842.00
CropBox:            36.00    36.00   468.00   513.00
BleedBox:           36.00    36.00   468.00   513.00
TrimBox:            36.00    36.00   468.00   513.00
ArtBox:             36.00    36.00   468.00   513.00

So the MediaBox is the paper size, and the CropBox is the bounding box. The other boxes seem to use the crop box value unless specified separately.

Upvotes: 0

KenS
KenS

Reputation: 31199

BoundingBox is the smallest area which encloses all the marks. The various Boxes defined in PDF files (many of which are optional) are not Bounding Boxes.

Without seeing your PDF file I cannot say what box(es) it actually contains, very possibly it only contains a MediaBox, and so that's the size you get.

If there is any white space around the edges of the content, then that is not counted for the BoundingBox, as it only counts marks.

In short, these are different measurements for different purposes.

Upvotes: 3

Related Questions