protected void onBtnViewClick() throws PresentationLogicException { PrintAgentDocumentsVo doc = form.grdDocuments().getValue(); if(doc == null) { engine.showMessage("Please select a document to view !"); return; } QueryBuilderClient qb = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId()); try { byte[] pdf = qb.convertReport(ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), doc.getDocument().getBytes(), QueryBuilderClient.PDF, "", 1); String url = qb.prepareReportForViewing(pdf, "PDF"); engine.openUrl(url); } catch (QueryBuilderClientException e) { engine.showMessage("Error viewing document: " + e.toString()); return; } }
protected void onBtnPrintClick() throws ims.framework.exceptions.PresentationLogicException { PrintAgentDocumentsVo doc = form.grdDocuments().getValue(); if(doc == null) { engine.showMessage("Please select a document to print !"); return; } String printer = form.cmbPrinter().getValue(); if(printer == null || printer.length() == 0) { engine.showMessage("Please select a printer !"); return; } QueryBuilderClient qb = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId()); try { qb.printReport(doc.getDocument().getBytes(), ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), printer, 1); } catch (QueryBuilderClientException e) { engine.showMessage("Error printing document: " + e.toString()); return; } }