String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT);
String scaleType = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_SCALE_TYPE);
String horizontalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HORIZONTAL_ALIGN);
String verticalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_VERTICAL_ALIGN);
JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider());
printImage.setStyle(element.getStyle());
printImage.setMode(element.getModeValue());
printImage.setBackcolor(element.getBackcolor());
printImage.setForecolor(element.getForecolor());
printImage.setX(element.getX());
printImage.setY(element.getY());
printImage.setWidth(element.getWidth());
printImage.setScaleImage(ScaleImageEnum.getByName(scaleType));
printImage.setHorizontalAlignment(HorizontalAlignEnum.getByName(horizontalAlignment));
printImage.setVerticalAlignment(VerticalAlignEnum.getByName(verticalAlignment));
FlyingSaucerXhtmlToImageRenderer renderer = new FlyingSaucerXhtmlToImageRenderer(getHtmlDocument(htmlContent), element.getWidth(), element.getHeight());
printImage.setRenderer(renderer);
if (printImage.getScaleImageValue() == ScaleImageEnum.REAL_HEIGHT || printImage.getScaleImageValue() == ScaleImageEnum.REAL_SIZE) {
printImage.setHeight(renderer.getComputedSize().height);
} else {
printImage.setHeight(element.getHeight());
}
return printImage;
}