COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => SDK => Topic started by: bnruser on 27 Jun 2007 04:24:17 AM

Title: Cognos8 in web Asp.net(with c#) --- PDF Save
Post by: bnruser on 27 Jun 2007 04:24:17 AM
Hi

We use Cognos8 in web Asp.net(with c#) application. We have a requirement of saving cognos reports in PDF in local directory, we could save the reports in pdf format in content store but not in local directory... Please advice.. Thanks in advance...

Title: Re: Cognos8 in web Asp.net(with c#) --- PDF Save
Post by: lloydke on 28 Jun 2007 08:11:22 AM
I would generate the report as a PDF and put it in the Content Store (like normal) then use this code to copy it out to another location:

public bool doCopy(contentManagerService1 c8CMS, string reportPath, string targetPath, ref string resultMessage)
     {
         if (c8CMS == null)
         {
               resultMessage = "...the Cognos 8 Server connection is invalid.\n";
               return false;
         }
         report rReport = new report();
         
         stringProp reportToCopy = new stringProp();
         reportToCopy.value = reportPath;
         rReport.searchPath = reportToCopy;
         baseClass[] bcaCopy = {rReport};
         copyOptions cpOptions = new copyOptions();

         searchPathSingleObject targetPathSO = new searchPathSingleObject();
         targetPathSO.Value = targetPath;

// sn_dg_sdk_method_contentManagerService_copy_start_0
         baseClass[] bcaCopyResults = c8CMS.copy(bcaCopy, targetPathSO, cpOptions);

         if (bcaCopyResults.GetLength(0) > 0)
         {
//returns the number of successfully copied baseClass objects
               resultMessage = "...the report has been successfully copied to : " + targetPath + ".\n";
               return true;
         }
// sn_dg_sdk_method_contentManagerService_copy_end_0
         else
         {
               resultMessage = "...copying the report to : \"" + targetPath + "\" failed.\n";
               return false;
         }
}
Title: Re: Cognos8 in web Asp.net(with c#) --- PDF Save
Post by: bnruser on 30 Jun 2007 01:45:57 AM
I would like to hvae the code to save as pdf .... becoz my code works for html format and bombs for pdf...

Thanks in advance...