This question relates to PyPDF2 used with Python 3
ghostscript apparently is able to effectively calculate the bounding box of the content within a PDF page as follows:
gs -dBATCH -dSAFER -dNOPAUSE -sDEVICE=bbox document1.pdf
The result returned in the example above appears to be correct and is:
GPL Ghostscript 9.10 (2013-08-30)
Copyright (C) 2013 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
%%BoundingBox: 88 525 521 718
%%HiResBoundingBox: 88.145997 525.401984 520.397984 717.533978
My question is, can the bounding box be calculated by PyPDF? If yes, any guidance on how to do so would be appreciated. I have dug hard but so far cannot see how to do it.
I am able to get PyPDF2 to give me the coordinates for the mediaBox, the cropBox, the artBox and the trimBox but these appear to be unrelated concepts to the bounding box.