text.setStyle(boldStyle);
return text;
}
private JRPrintElement printImage(String imageName, int posX, int posY, int width, int height) {
JRBasePrintImage image = new JRBasePrintImage(jasperPrint.getDefaultStyleProvider());
image.setX(posX);
image.setY(posY);
image.setWidth(width);
image.setHeight(height);
image.setScaleImage(JRImage.SCALE_IMAGE_FILL_FRAME);
try {
File photoPath = new File(Constants.PHOTO_DIR + imageName);
if (photoPath.exists()) {
image.setRenderer(
JRImageRenderer.getInstance(
JRImageLoader.loadImageDataFromLocation(Constants.PHOTO_DIR + imageName)
)
);
}