Bug 691145 - Trimbox not being cropped properly
Summary: Trimbox not being cropped properly
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 8.71
Hardware: PC Linux
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-26 05:33 UTC by Raine Ekman
Modified: 2010-02-27 17:22 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Sample file: big-crop-trim-box.pdf (852 bytes, application/pdf)
2010-02-27 17:16 UTC, Alex Cherepanov
Details
patch (2.23 KB, patch)
2010-02-27 17:18 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raine Ekman 2010-02-26 05:33:52 UTC
$ 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."
Comment 1 Alex Cherepanov 2010-02-27 17:16:52 UTC
Created attachment 5996 [details]
Sample file: big-crop-trim-box.pdf
Comment 2 Alex Cherepanov 2010-02-27 17:18:40 UTC
Created attachment 5997 [details]
patch

Following PDF reference, version 1.7, section 10.10, crop /TrimBox and /CropBox

by the /MediaBox.
Comment 3 Alex Cherepanov 2010-02-27 17:20:44 UTC
The patch has been committed as a rev. 10824.
Regression testing shows no differences.
Comment 4 Alex Cherepanov 2010-02-27 17:22:15 UTC
Comment on attachment 5996 [details]
Sample file: big-crop-trim-box.pdf

A simple sample file with MediaBox and TrimBox extending beyond MediaBox