DefaultTemplateBuilder builder = new DefaultTemplateBuilder();
builder.setApplicationId(mapWidget.getApplicationId());
builder.setMapModel(mapWidget.getMapModel());
builder.setMarginX((int) PrintingLayout.templateMarginX);
builder.setMarginY((int) PrintingLayout.templateMarginY);
PageSize size = PageSize.getByName((String) sizeItem.getValue());
if (LANDSCAPE.equals(orientationGroup.getValue())) {
builder.setPageHeight(size.getWidth());
builder.setPageWidth(size.getHeight());
} else {
builder.setPageHeight(size.getHeight());
builder.setPageWidth(size.getWidth());
}
builder.setTitleText((String) titleItem.getValue());
builder.setWithArrow((Boolean) arrowCheckbox.getValue());
builder.setWithScaleBar((Boolean) scaleBarCheckbox.getValue());
builder.setRasterDpi((Integer) rasterDpiSlider.getValue());