Bug 53133

Summary: [pdfinfo] Wrong page size info displayed if PDF uses CropBox
Product: poppler Reporter: pipitas
Component: utilsAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: 1-page PDF with CropBox different from MediaBox

Description pipitas 2012-08-05 00:30:03 UTC
Created attachment 65133 [details]
1-page PDF with CropBox different from MediaBox

Attached is a 1-page PDF which uses...

 ... a media box of 667x950 pt, accompanied by 
 ... a crop  box of 595x842 pt (no bleed-, trim- or art box specified).

Yet pdfinfo reports as "page size" a value of 595x842 pt (when it should be 667x950 pt, or not?)

The value pdfinfo calculates here is the width and height of the trim box, not the page size....


pdfinfo -box my-cropped.pdf
  Producer:       GPL Ghostscript 9.05
  CreationDate:   Sun Aug  5 01:35:27 2012
  ModDate:        Sun Aug  5 01:35:27 2012
  Tagged:         no
  Form:           none
  Pages:          1
  Encrypted:      no
  Page size:      595 x 842 pts (A4)
  Page rot:       0
  MediaBox:           0.00     0.00   667.00   950.00
  CropBox:            0.00     0.00   595.00   842.00
  BleedBox:           0.00     0.00   595.00   842.00
  TrimBox:            0.00     0.00   595.00   842.00
  ArtBox:             0.00     0.00   595.00   842.00
  File size:      8494 bytes
  Optimized:      no
  PDF version:    1.4


A 'competitor' to pdfinfo, podofopdfinfo, reports the expected value:

podofopdfinfo D my-cropped.pdf 

  Document Info
  -------------
	File: my-cropped.pdf
	PDF Version: 1.4
	Page Count: 1
	Page Size: 667 x 950 pts



Editing the PDF's *trim* box values to [667 950] yields the correct *page* size:

  [....]
  Page size:      667 x 950 pts
  Page rot:       0
  MediaBox:           0.00     0.00   667.00   950.00
  CropBox:            0.00     0.00   667.00   950.00
  BleedBox:           0.00     0.00   667.00   950.00
  TrimBox:            0.00     0.00   667.00   950.00
  ArtBox:             0.00     0.00   667.00   950.00
  [....]
Comment 1 pipitas 2012-08-05 00:39:27 UTC
D'oh... scrap this.

Mea culpa máxima! (It's too late at night I made an error.)

Of course pdfinfo is right in reporting the values it does, and podofopdfinfo is wrong.

 "Page size" is not defined at all in the PDF spec, and it says this in its definition of "crop box":

  +------------------------------------------------------------+
  |  A rectangle, expressed in default user space units,  that |
  |  shall define the region to which the contents of the page |
  |  shall be clipped when output in a production environment. |
  +------------------------------------------------------------+

Therefor it is quite reasonable what pdfinfo reports as "page size" for the example PDF.

Sorry for the noise.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.