Page 1 of 1

Report Printing Detection

PostPosted: Wed Jul 01, 2026 5:05 pm
by SBarnes
Is there an event that can be used to detect the printing of any and all reports in Jiwa?

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 5:42 pm
by Scott.Pearce
Try JiwaPrintReport.AfterPrintOutputControllerPrintReport

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 5:51 pm
by SBarnes
Thanks Scott, but I already tried that should it fire on preview or only print and if its print is there something similar for preview?

Code: Select all
public class BusinessLogicPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogicPlugin
{

    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic JiwaBusinessLogic, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      if (JiwaBusinessLogic is JiwaFinancials.Jiwa.JiwaApplication.JiwaPrintReport.JiwaPrintReport)
       {
      var reportPrint = (JiwaFinancials.Jiwa.JiwaApplication.JiwaPrintReport.JiwaPrintReport)JiwaBusinessLogic;
           reportPrint.AfterPrintOutputControllerPrintReport += ReportPrint_AfterPrintOutputControllerPrintReport;
       }      
    }
   
   private void ReportPrint_AfterPrintOutputControllerPrintReport(
       ref JiwaFinancials.Jiwa.JiwaApplication.JiwaPrintReport.JiwaPrintReport jiwaPrintReport,
       ref JiwaFinancials.Jiwa.JiwaApplication.PrintGroup.Maintenance.LogicalPrinter printer,
       ref int copies,
       ref CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions printReportOptions)
   {
      System.Diagnostics.Debugger.Launch();
   }   
}

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 5:58 pm
by Scott.Pearce
That event will only fire on print to printer.

For preview try listening to JiwaPrintReportUI.Mainform.CrystalReportViewer1.ReportRefresh. But you will have to add your handler by listening to the FormFactory.AfterFormStart and looking at the type of the form created (JiwaPrintReportUI.Mainform).

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 6:00 pm
by SBarnes
Thanks

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 6:03 pm
by Mike.Sheen
A similar question was asked by Danny over in this topic.

I mention there that you could hide the report preview toolbar, and add your own so you can then know when the preview is actually printed (if that's what you are after).

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 6:10 pm
by SBarnes
Thanks, but no this more about the possibility of logging what reports are being run.

Re: Report Printing Detection

PostPosted: Wed Jul 01, 2026 6:42 pm
by Mike.Sheen
SBarnes wrote:Thanks, but no this more about the possibility of logging what reports are being run.


If the user story is: "We want to log whenever anyone runs any reports" then you could add a handler to the Business logic factory's AfterBusinessLogicSetup if the object is the JiwaPrintReport business logic, then add a handler for it's ReadEnd event.

You could just log that - but that'll log when someone just has launched a menu report and are looking at the ranges and have not generated a report yet - so if that's a concern, there might be an event coming out of the CrystalDecisions.CrystalReports.Engine.ReportDocument or JiwaApplication.Report.Configuration.Report (which are properties of the JiwaPrintReport business logic) that you could use to determine when a report is generated - I don't know, I've not looked at those API's to see what is available.