to get crop box, bleed box, trim box and art box always fails

24 views
Skip to first unread message

Han Chipset

unread,
Jul 18, 2021, 11:26:32 PM7/18/21
to pdfium
I test many pdf files got on the net. To get the crop box, trim box, bleed box and art box, always fails, but for the media box and bounding box always succeeds. All related function protocols hereby are in file fpdf_tranformpage.h

If we cannot get the crop box, trim box, bleed box and art box, how to differentiate the header and footer from other contents in one page? Can anyone else tell me how?

Thanks in advance.

Lei Zhang

unread,
Jul 19, 2021, 1:49:45 PM7/19/21
to Han Chipset, pdfium
For the files you tested, do they have crop/trim/bleed/art boxes to
start with? Can you provide an example of a PDF to demonstrate the
issue?
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/bf3dabd8-41b3-4a9f-befb-610799d20568n%40googlegroups.com.

Han Chipset

unread,
Jul 20, 2021, 12:41:33 AM7/20/21
to pdfium
Hi, Zhang

Thanks for your response.

I am not sure whether there are crop/trim/bleed/art boxes or not as I do not use any PDF editors. I downloaded the PDF files from Internet. Here are some.

Then, there is another point. If there is no such boxes, using pdfium, how to identify header and footer in the pages of PDF files?

Thanks.

Lei Zhang

unread,
Jul 20, 2021, 1:51:23 AM7/20/21
to Han Chipset, pdfium
Many PDFs do not have these boxes. The crop box is relatively common.
e.g. PDF32000_2008.pdf has them. The others are much rarer. As such,
APIs like FPDFPage_GetBleedBox() will likely fail because the bleed
box simply does not exist.

If you read the PDF spec you linked to, section 7.7.3.3 explains the
bleed box is optional, and what the default value is when it does not
exist. PDFium APIs simply retrieve the box values if they exist. They
do not interpret the spec and fill in the default.

As for headers and footers on a page, in general, I don't think PDFs
have such a concept.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/86d09031-0529-486e-bd43-50a8d98e8a01n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages