}
public void execute(PrintGetTemplateRequest request, PrintGetTemplateResponse response) throws Exception {
// you dirty hack you...
PrintTemplateInfo template = request.getTemplate();
PageComponent page = (PageComponent) converterService.toInternal(template.getPage());
MapComponentImpl mapComponent = (MapComponentImpl) page.getChild(PrintTemplate.MAP);
if (mapComponent != null) {
LegendComponentImpl legendComponent = (LegendComponentImpl) mapComponent.getChild(PrintTemplate.LEGEND);
if (legendComponent != null) {
LabelComponentImpl lab = (LabelComponentImpl) legendComponent.getChild(PrintTemplate.TITLE);
if (lab != null) {
lab.setText(legendComponent.getTitle());
}
// need to do this before setSizeAndFit
adjustLegendFontSizeForSmallPageSizes(request, legendComponent);
}
}
if (request.getPageSize() != null) {
page.setSize(request.getPageSize(), true);
}
SinglePageDocument pdfDoc = new SinglePageDocument(page, null);
// layout the document
pdfDoc.layout(Format.PDF);
// Add document to container