Server generates A student letter which includes two parts. one about information of student and admission details and other is the identity card.
I want to crop out the identity card of student to jpeg file and print it.
But the problem is the location of the card is not consistent. If it was then there was no problem.
To undertand it better take a look at the structre of the content:
The identity card is inside the cutout part which is lower one.
Now as there is free space and the location of content is changed sometimes.
like in the image the free space is at the bottom and content is not in center but at times the free space is at the top and content is centerd/not centered.
Is it possible to remove blank space from TOP RIGHT BOTTOM LEFT and convert the pdf to jpeg having just the outer border with content inside with Ghostscript ?
If not then is there any way to detect the position of the outer border ?
The PDF Generation server is not under my controll i just have the PDF.