Detect Cancellation of Printing

For logging purposes, I need to be able to detect whether a call to Report.Print()/Report.PrintPrepared() was aborted by the user by clicking the "Cancel" button in the FastReport print dialog.

Any advice on how to solve this problem would be greatly appreciated.


Comments

  • Hello!

    Print() and PrintPrepared() do not return a result, but we have a built-in method that displays the same print dialogue and indicates whether the user clicked ‘Print’ or cancelled:

    if (!report.Prepare()) return;
    
    if (report.ShowPrintDialog(out var printerSettings))
    {
    report.PrintPrepared(printerSettings);
    _log.Info(‘Printing has started’);
    }
    else
    {
    _log.Info(‘Printing cancelled by the user’);
    }
    
This discussion has been closed.