How can I identify a clip path as being page Crop/Media/... box?


Though I can query separately, and get the "core" boxes that delineate
a PDF, when I iterate through the elements, is there a way I can
identify if a specific element is one of those boxes?

Let me explain better...

Upon first opening a PDF file, I get each of...
Art Box,
Bleed Box,
Crop Box,
Media Box,
Trim Box

From the example file attached...

Art Box : {X=45,Y=45,Width=612,Height=792}
Bleed Box : {X=36,Y=36,Width=630,Height=810}
Crop Box : {X=0,Y=0,Width=702,Height=882}
Media Box : {X=0,Y=0,Width=702,Height=882}
Trim Box : {X=45,Y=45,Width=612,Height=792}

Later, I traverse each of the elements within the PDF.

My problem is that often there are clipping paths that match the size
and position of these boxes.

I don't want to ignore the contents of (for example) the bleed box.
But when I iterate through the elements and finally hit a clipping
path that matches it, how can I tell if this is the bleed box, or
truly another clipping path.
IE: {X=36,Y=36,Width=630,Height=810} | Type : e_path |
IsClippingpath : True | IsStroked : False | IsFilled : False

Using the ElementReader, that was the 3rd element.
# 1) e_marked_content_begin
# 2) e_group_begin
# 3) e_path
Is this actually the bleed box, or is this an extraneous clipping

Is there a property or other way that exposes if an element is one of
those core boxes?
IE: element.IsBleedBox()

I've used the bleed box in this example, however if it makes any
difference, the crucial ones for me to identify are the media and trim

Page boxes (i.e. Art Box, Bleed Box, Crop Box, Media Box, and Trim
Box) are specified only on the page level and they don't have any
explicit relation to clip paths that occur in the page content stream.
In some cases a clip path may have some metadata associated with it
that can be used to infer special properties about the clip paths
however this is not very reliable.

You could also compare the 'bbox' of the clipping path and test for
similarity between the corresponding page bbox.