<%@ page import = "com.crystaldecisions.report.web.viewer.*,
com.crystaldecisions.sdk.occa.report.exportoptions.*,
com.crystaldecisions.sdk.plugin.desktop.common.*"
%>
<%@ include file="logon.jsp" %>
<%
ReportExportControl exporter = new ReportExportControl(); //ReportExportControl is used to initialize viewer
ExportOptions exportOptions = new ExportOptions(); //use ExportOptions object to set Format
ReportExportFormat exportFormat = ReportExportFormat.PDF; //set Format to PDF
try{
iStore = (IInfoStore) es.getService("", "InfoStore");
oInfoObjects = (IInfoObjects) iStore.query("Select * from CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report' And SI_INSTANCE = 0 And SI_NAME='Consolidated Balance Sheet'");
oInfoObject = (IInfoObject) oInfoObjects.get(0);
//use the ReportSource to initialize the viewer
//pass in the InfoObject and the EnterpriseSession
exporter.setReportSourceClassFactoryName("com.crystaldecisions.sdk.occa.report.application.reportsourcefactory.PSReportSourceFactory");
exporter.setEnterpriseLogon(es);
exporter.setReportSource(oInfoObject);
//Set the Export Format to PDF
exportOptions.setExportFormatType(exportFormat);
exporter.setExportOptions(exportOptions);
//view the exported report in PDF format
exporter.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
}
catch(SDKException e)
{
out.println(e.getMessage());
}
%>