builder.setWithArrow((Boolean) arrowCheckbox.getValue());
builder.setWithScaleBar((Boolean) scaleBarCheckbox.getValue());
builder.setRasterDpi((Integer) rasterDpiSlider.getValue());
PrintTemplateInfo template = builder.buildTemplate();
request.setTemplate(template);
final GwtCommand command = new GwtCommand(PrintGetTemplateRequest.COMMAND);
command.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {
public void execute(CommandResponse r) {
stopProgress();
if (r instanceof PrintGetTemplateResponse) {
PrintGetTemplateResponse response = (PrintGetTemplateResponse) r;
GWT.log("Downloading " + response.getDocumentId(), null);
UrlBuilder url = new UrlBuilder(GWT.getHostPageBaseURL());
url.addPath("d/printing").addParameter("documentId", response.getDocumentId());
url.addParameter("name", (String) fileNameItem.getValue());
url.addParameter("userToken", command.getUserToken());
if ("save".equals(downloadTypeGroup.getValue())) {
url.addParameter("download", "1");
String encodedUrl = url.toString();
// create a hidden iframe to avoid popups ???
HTMLPanel hiddenFrame = new HTMLPanel("<iframe src='" + encodedUrl