Вот еще один способ обрезать изображение с помощью PdfTemplate.
public static Image cropImage(Image image, PdfWriter writer, float x, float y, float width, float height) throws DocumentException {
PdfContentByte cb = writer.getDirectContent();
PdfTemplate t = cb.createTemplate(width, height);
float origWidth = image.getScaledWidth();
float origHeight = image.getScaledHeight();
t.addImage(image, origWidth, 0, 0, origHeight, -x, -y);
return Image.getInstance(t);
}
Обратите внимание, что для этого не требуется вызывать t.rectangle (), t.clip () или t.newPath ().