This one's partially for Earl. At the very least, he pretended to want to know what it is that I'm working on. Well, to appease him and the inborn desire to be understood, I will explain.
The problem is this: Pro/Engineer is the CAD software that my Engineering firm uses. It has a lot of automated things, like the creation of a PDF representation of the drawings the engineers and designers create.
There is a problem with the way that Pro/E creates the file, though. The size for the first page is automatically given to all ensuing pages. This is not a problem as long as all of the pages are the same size. We at Sperry Drilling Services use a standard letter-sized page for Bills of Material, which are generally page 2 and beyond.
So, the PDF that is generated looks like this:
What I have been doing is going through the file and finding the topmost mark and the rightmost mark made in the postscript file (which is the transitional file that Adobe takes and turns into a PDF.
I make the pagesize as large as the furthest distance right and up, and that crops the pages so that they are correct.
The next challenge is dealing with the bottom margin. I'm still working on it but it looks like I'm going to be shifting everything down as far as the distance from the bottom-most mark to the bottom of the page.
Given that the test postscript file I have is 589,000 lines long, I'm also learning a lot about the efficiency of certain algorithms.