$ grep -a Box problem.pdf |grep -v FontBBox /TrimBox [28.3297 29.0042 624.602 870.126] /MediaBox [0.0 0.0 841.89 595.276] /CropBox [0.0 0.0 841.89 595.276] /BleedBox [28.3297 29.0042 624.602 870.126] $ gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 -sOutputFile=problem.jpg problem.pdf GPL Ghostscript 8.71 (2010-02-10) Copyright (C) 2010 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 $ identify problem.jpg problem.jpg JPEG 1754x1240 1754x1240+0+0 8-bit DirectClass 224KB 0.000u 0:00.000 $ gs -dUseTrimBox -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 - dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 - sOutputFile=problem.jpg problem.pdf $ identify problem.jpg problem.jpg JPEG 1242x1752 1242x1752+0+0 8-bit DirectClass 135KB 0.000u 0:00.000 This seems to be the entire TrimBox with quite a bit of empty space from outside the MediaBox. Shouldn't the second result really be an intersection of the MediaBox and the TrimBox, as the PDF reference, version 1.7, section 10.10 states: "The crop, bleed, trim, and art boxes should not ordinarily extend beyond the boundaries of the media box. If they do, they are effectively reduced to their intersection with the media box."
Created attachment 5996 [details] Sample file: big-crop-trim-box.pdf
Created attachment 5997 [details] patch Following PDF reference, version 1.7, section 10.10, crop /TrimBox and /CropBox by the /MediaBox.
The patch has been committed as a rev. 10824. Regression testing shows no differences.
Comment on attachment 5996 [details] Sample file: big-crop-trim-box.pdf A simple sample file with MediaBox and TrimBox extending beyond MediaBox