Efficient method to determine extents of visible objects on page

I have created an application that must determine the amount of white space on the top and bottom of a document.

I am utilizing a method that converts the page to a bitmap and queries rows of bits to determie whether or not the row has a bit with a color other than white.

This method works but is less than optimal from a performance perspective. Is there a more efficient method to determine the extents of visible objects on a page?


Are you using the same method as offered by Aspose.PDF to trim white spaces around the PDF? OR you are using any custom method? Please share a bit more details along with sample file and performance overhead details that you are noticing. We will log an investigation ticket to address it and share the ID with you.