Bug 39170

Summary: pdftoppm handles PDF files with cropbox not correct
Product: poppler Reporter: Denny Reeh <denny.reeh>
Component: utilsAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: PDF with cropbox
image1-1.png
image2-1.png
screenshot.png

Description Denny Reeh 2011-07-12 05:14:10 UTC
i've found an issue with pdf files with cropbox. a white border is rendered.

example:
the pdf with 200px width and 100px height has a cropbox of 5 pixel at all borders. so the mediabox is only 190px x 90px.

"pdftoppm -cropbox" converts the pdf to a 200px x 100px ppm image. the cropbox is in the image. all is fine.

"pdftoppm" (without -cropbox) converts also a 200px x 100px ppm image, but the 5px border is white around the 190px x 90px mediabbox.


pdftoppm version 0.17.1
source compiled on gentoo linux.


do you need example files or some more information?
Comment 1 Albert Astals Cid 2011-07-12 05:26:42 UTC
Yes, attach sample files
Comment 2 Denny Reeh 2011-07-12 10:09:55 UTC
Created attachment 49016 [details]
PDF with cropbox
Comment 3 Denny Reeh 2011-07-12 10:11:47 UTC
Created attachment 49017 [details]
image1-1.png
Comment 4 Denny Reeh 2011-07-12 10:12:15 UTC
Created attachment 49018 [details]
image2-1.png
Comment 5 Denny Reeh 2011-07-12 10:14:57 UTC
here are my commands:

for image1:

pdftoppm -q -f 1 -l 1 -r 72 -cropbox -png -scale-to-x 558 -scale-to-y 293 cropbox.pdf image1


for image2:

pdftoppm -q -f 1 -l 1 -r 72 -png -scale-to-x 558 -scale-to-y 293 cropbox.pdf image2


image2-1.png now has a white border.

expected result: the image2 was converted from von pdf (withput cropbox) and and scaled up to given x/y.
Comment 6 Albert Astals Cid 2011-07-18 11:48:31 UTC
I don't see any problem, if you do not specify -cropbox the cropbox is not used and thus you get the white borders outside the cropbox. Seems like proper behaviour to me.
Comment 7 Denny Reeh 2011-07-18 12:15:10 UTC
the white border is the right way to handle it?

i think, if no -cropbox is set, the ppm have to be the whole width of 220,49mm in this example (without a white border over the red background).

if it's the right way, in which usage i shouldn't use -cropbox? a image with a white border seams corrupt for me.

and finally, i can't know that i have to use -cropbox with some pdfs.
Comment 8 Albert Astals Cid 2011-07-18 12:49:50 UTC
> the white border is the right way to handle it?

the white border is not "the right way to handle it", the white border is there in the pdf file and we render it because you ask us to do it.

> i think, if no -cropbox is set, the ppm have to be the whole width of 220,49mm
> in this example (without a white border over the red background).

Why? If you do not set the cropbox, we render according to the mediabox, and the white rectangle is there, so we render it.

> if it's the right way, in which usage i shouldn't use -cropbox? 

When you want to render the mediabox instead of the cropbox

> a image with a white border seams corrupt for me.

Again, we add no white border at all, we just render what is on the pdf.
 
> and finally, i can't know that i have to use -cropbox with some pdfs.

Please read about the cropbox, mediabox, et al concepts regarding PDF because it seems to me you really do not seem to know what you are talking about. Basically you most probably always want the cropbox option.

I'm closing the bug because i see in no way we do anything wrong.
Comment 9 Denny Reeh 2011-07-18 13:22:40 UTC
i'm knowing the concepts of the borders in pdf.

Mhh, in the pdf there are no white borders. please have a look in arcobat. i have attached a screenshot of it. the green border is the cropbox (Beschnitt-Rahmen in german).

you can verify where the white border comes from?
Comment 10 Denny Reeh 2011-07-18 13:24:08 UTC
Created attachment 49270 [details]
screenshot.png
Comment 11 Albert Astals Cid 2011-07-18 14:14:27 UTC
I see a white border in that screenshot
Comment 12 Denny Reeh 2011-07-18 14:28:57 UTC
you are right. sorry for my confusion.

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.