How do I draw a subset of a PDF page (bounding box for all content on the page)?

Q: I need to fit the "image" of the PDF page (the portion of the page
that actually has stuff on it) not the full page. PDFDraw fits the
entire page (based on the CropBox), not just the contents.

Is there an easy way to reset the CropBox to just the area on the page
that has something on it?
-----
A: You can use page.SetCropBox() to change the size of the crop box,
prior to rendering the page using PDFDraw.

You can use element.GetBBox(rect) to obtain a bounding box for every
element of the page. Looping through all elements on the page is the
only way to compute a bounding box for all content on the page.
Actually this may not be that simple since some elements may be
clipped or invisible, but is probably a good starting point.