Bug 53724

Summary: [PATCH] Fop-pdf-images extension should ignore crop box dimensions if bigger than media box
Product: Fop - Now in Jira Reporter: Matthias Reischenbacher <matthias8283>
Component: imagesAssignee: fop-dev
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   
Bug Depends on: 53468    
Bug Blocks:    
Attachments: Patch

Description Matthias Reischenbacher 2012-08-15 15:48:26 UTC
The PDF spec says (section 10.10.1 Page Boundaries, Version 1.7): "The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. It may also include areas close to the edges of the medium that cannot be marked because of physical limitations of the output device. Content falling outside this boundary can safely be discarded without affecting the meaning of the PDF file."

I've seen PDF files (created with Adobe Illustrator) which have a crop box exceeding the size of the media box. The fop-pdf-images extensions doesn't handle this special case correctly because the crop box is always used, without checking if the dimensions are actually smaller than the media box. Therefore the "content falling outside this boundary" is not discarded as suggested by the PDF spec.

As soon as patch 53468 is processed, I'll provide a patch for this issue too (there are changes in the same source file which makes it impossible to provide a clean Patch).
Comment 1 Matthias Reischenbacher 2012-08-16 18:37:29 UTC
Created attachment 29239 [details]
Patch
Comment 2 Pascal Sancho 2012-08-27 07:55:06 UTC
probably related to #48302
Comment 3 Mehdi Houshmand 2012-09-26 10:39:05 UTC
I think this has been fixed by the fix to bug#53909. Could you test it out and set this bug to resolved if you're happy with the fix. Thanks
Comment 4 Matthias Reischenbacher 2012-09-26 19:14:03 UTC
I just tested your changes, but no. Additionally they break my patch. After commenting:
at.translate(mediaBox.getLowerLeftX() - viewBox.getLowerLeftX(),
                mediaBox.getLowerLeftY() - viewBox.getLowerLeftY());

and re-inserting:
at.translate(-viewBox.getLowerLeftX(), -viewBox.getLowerLeftY());

it starts to work again.

I can send you a sample PDF file off list, if you want to.