You need to get the
/CropBox value from the page dictionary. In iText 7 this can be done in the following way:
PdfPage page = pdfDoc.getPage(pageIndex); Rectangle cropBox = page.getCropBox(); Rectangle mediaBox = page.getMediaBox();
In many cases,
cropbox will be
null in which case you can safely ignore it and use the
mediabox value instead.
cropbox value (or if
mediabox) is a
Rectangle object with
y coordinates and
height values. If you want to crop a page, you need to change these coordinates and either replace the existing
cropbox value (if one already exists) or add a new
cropbox value (if there is none):
page.setCropBox(new Rectangle(newX, newY, newWidth, newHeight));
Click How can I crop the pages of an existing PDF document? if you want to see how to answer this question in iText 5.