If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Cognos8 in web Asp.net(with c#) --- PDF Save

Started by bnruser, 27 Jun 2007 04:24:17 AM

Previous topic - Next topic

bnruser

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...


lloydke

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;
         }
}

bnruser

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...