Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Export a Report to PDF Post Reply Post New Topic
Author Message
rajeshkottakota
Newbie
Newbie


Joined: 11 Nov 2007
Location: India
Online Status: Offline
Posts: 5
Quote rajeshkottakota Replybullet Topic: Export a Report to PDF
    Posted: 16 Dec 2007 at 10:15pm
Hi,
   This is Rajesh, i am using Crystal Report XI with PSReportFactory... when i am exporting a report to PDF, i am getting the exception, ie
ReportSDKLogonException: Information is needed before this report can be processed.---- Error code: 2147217393 Error code ame:dbLogonFailed.
 
my code:-
 

    ISessionMgr iSessionMgr = CrystalEnterprise.getSessionMgr();
    //Logon to Enterprise
    IEnterpriseSession iEnterpriseSession = iSessionMgr.logon(username, password, cmsname, authType);
    //Retrieve the InfoStore object from the Enterprise Session
    IInfoStore oInfoStore = (IInfoStore)iEnterpriseSession.getService("", "InfoStore");
    
   //Retrieve the report from the Enterprise System
   String       query  = "Select * From CI_INFOOBJECTS Where SI_NAME = '"+REPORT_NAME+"'";
   IInfoObjects oInfoObjects = oInfoStore.query(query);
   IInfoObject  oReport = (IInfoObject)oInfoObjects.get(0); 
   IReport report = (IReport)oReport;
   
   IReportSourceFactory2 psReportSourceFactory = (IReportSourceFactory2) iEnterpriseSession.getService("","PSReportFactory");
   Object reportSource = psReportSourceFactory.createReportSource(oReport,Locale.ENGLISH);
   
   Debug.println("checking the DBCredentials.............");
   ConnectionInfos connInfos = new ConnectionInfos();
     IConnectionInfo connInfo1 = new ConnectionInfo();
     connInfo1.setUserName(dbUserName);
     connInfo1.setPassword(dbPassword);
     //add the IConnectionInfo object into the ConnectionInfo collection
     connInfos.add(connInfo1);
    
      // get the query id, the time in milliseconds
    long queryID = System.currentTimeMillis();
    String queryId = Long.toString(queryID);
    Debug.println("adding the parameters to arraylist");
     ArrayList parameters = new ArrayList();
     parameters.add(queryId);
     parameters.add(str_Rpt_InvoiceNo);
     parameters.add(str_Rpt_CompanyID);
    
     Debug.println("Setting to ....ExportControl...");
     exportControl.setReportSource(reportSource);
     //exportControl.setEnableLogonPrompt(false);
     exportControl.setParameterFields(setParameters(report,parameters));
     exportControl.setDatabaseLogonInfos(connInfos);
     //exportControl.setEnableParameterPrompt(false);
    
   RequestContext reqCon = new RequestContext();
   reqCon.getReportStateInfo();
   reqCon.getSubreportRequestContext();
   ExportOptions exportOptions = new ExportOptions();
   exportOptions.setExportFormatType(ReportExportFormat.PDF);
   Debug.println("converting into bytes........");       
 
//here i am getting the exception....     
   ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)((IReportSource) reportSource).export(exportOptions, reqCon);
   
   rptDetails = new ARChopsDAO(companyId.longValue()).getJRptName(str_InvoiceNo);
            str_Rpt_fileName = rptDetails[1];
            str_fileDesciption = rptDetails[2];
   
   //Write file to disk...
   String EXPORT_OUTPUT = EXPORT_LOC + str_Rpt_fileName;
   Debug.println("Destination....."+EXPORT_OUTPUT);
      writeToFileSystem(byteArrayInputStream, EXPORT_OUTPUT);
   exportControl.dispose();
 
 
please help me......
  


Edited by rajeshkottakota - 16 Dec 2007 at 10:16pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.023 seconds.