I have a program that creates custom paper size pdf files (900x5000 mm) because A0 is not large enough in some cases.
This results in a pdf with White borders arround the "inked space", how can I determine what the inked space is and crop the pdf?
The creator program should have defined the CropBox/TrimBox attribute of the page in order to exclude extra prepress space from the final output. If that's not the case, you have to heuristically iterate through the page's content stream to verify the actual contents region limits - that's upon you (figure it out looking at the code samples included in the distribution, ContentScanner class is your best friend in this situation).
There is no Crop or Trimbox defined so I'll need to loop trough all the page content to determine the Minx, Miny, MaxX and MaxY
I figured out that I'll need to use the ContentScanner but it aint going to be simple.
If i find a solution I'll post the code I used here so if someone else wants to use it there is a sample for this specific problem.