1
嗨我們如何在iText中調整圖像大小7。 我現在無法在itext 7中找到用於裁剪圖像的PDFTemplate。 。Itext7 - 裁剪圖像
public Image cropImage(PdfWriter writer, Image image, float leftReduction, float rightReduction, float topReduction, float bottomReduction) throws DocumentException {
float width = image.getScaledWidth();
float height = image.getScaledHeight();
PdfTemplate template = writer.getDirectContent().createTemplate(
width - leftReduction - rightReduction,
height - topReduction - bottomReduction);
template.addImage(image,
width, 0, 0,
height, -leftReduction, -bottomReduction);
return Image.getInstance(template);
}
這是用於iText的5
謝謝讓我檢查:) –
也接受了這一個:) –