Print Cancelled Through Print Dialog Box

Posted by: trisha.b.sinha on 8 September 2020, 12:52 am EST

    • Post Options:
    • Link

    Posted 8 September 2020, 12:52 am EST

    Hi,

    I am using ActiveReports Version 13. If the user has clicked “Cancel” on the built-in Active Reports print dialog box from save and cancel button, I have additional actions like save to given location that need to happen if the report was printed but should not happen if it gets canceled.

    If User Canceled in save location Popup it will directly return from popup without executing further code.

    Example of Code:

    arViewer.Document.Printer.PrinterSettings = mvobjReportPrinter.PrinterSettings;

    arViewer.Document.Print(false);

  • Posted 8 September 2020, 8:28 pm EST

    Hello,

    Sorry to mention that I do not understand you requirement. Could you please explain in detail so that I will help you accordingly. It will be very helpful for us if you provide demo sample.

    Thanks,

    Mohit

  • Posted 8 September 2020, 8:28 pm EST

    Hello,

    Sorry to mention that I do not understand you requirement. Could you please explain in detail so that I will help you accordingly. It will be very helpful for us if you provide demo sample.

    Thanks,

    Mohit

  • Posted 8 September 2020, 10:12 pm EST

    Hi,

    I want to return if user press cancel in showPrintProgressDialog for pdf print.For that I am using following code.

    arViewer.Document.Printer.PrinterSettings = mvobjReportPrinter.PrinterSettings;

    arViewer.Document.Print(false,true,false);

    In which it will display showPrintProgressDialog with save and Cancel button.If user select cancel I want to return it from code and if save then it will move further.

    Thanks.

  • Posted 9 September 2020, 8:25 pm EST

    Hello,

    Sorry to mention that it is microsoft showPrintProgressDialog and we don’t have control on this.

    However, You can use “Viewer1.Document.PrintAborted” event which is fire when the user presses the cancel button.

    Hope it helps.

    Thanks,

    Mohit

  • Posted 10 September 2020, 2:09 am EST

    Hi,

    Thanks for your feedback.

    Can you explain in detail Viewer1.Document.PrintAborted event as I am not able to get execute this event on cancel of savefiledialog.

    Or else if possible can you please provide any link from which I can understand in detail and able to implement in my code.

    arViewer.Document.Printer.PrinterSettings = mvobjReportPrinter.PrinterSettings;

    arViewer.Document.Print(false,true,false);

    Using this code we are opening savefiledialog directly except printdialog so on cancel of savefiledialog I want to direct return from my code and it will not execute further.

    Thanks.

  • Posted 10 September 2020, 7:31 pm EST

    Hello,

    What I understood, you are printing the report using the “Microsoft Print to Pdf” to print the report and you talking about the save dialog which appear to save PDF. If my understanding is correct, then sorry it not possible to handle the Cancel button of “SaveDialog” of Pdf. Also, PrintAborted event fire only when you press the Cancel button in PrintProgressDialog not in SaveDialog.

    Thanks,

    Mohit

  • Posted 10 September 2020, 7:31 pm EST

    Hello,

    What I understood, you are printing the report using the “Microsoft Print to Pdf” to print the report and you talking about the save dialog which appear to save PDF. If my understanding is correct, then sorry it not possible to handle the Cancel button of “SaveDialog” of Pdf. Also, PrintAborted event fire only when you press the Cancel button in PrintProgressDialog not in SaveDialog.

    Thanks,

    Mohit

  • Posted 10 September 2020, 8:58 pm EST

    Hi,

    Yes You understand the correct we want to handle cancel button of “saveDialog” to pdf.But is there any way to know that the pdf is saved or not so based on that we can proceed further.

    Thanks.

  • Posted 10 September 2020, 9:14 pm EST

    Hello,

    You can declare a flag variable and set to 0. After that you can use “Viewer1.Document.PrintProgress” event and set the flag value to 1 in the PrintProgress event.

    Therefore, if flag value is 1 then pdf is saved otherwise not.

    Hope it helps.

    Thanks,

    Mohit

  • Posted 11 September 2020, 1:36 am EST

    Hi,

    Thanks for your immediate response. I will try your given code and will update whether it works for me or not.

    PrintProgress event works for us to handle save and cancel functionality of savefiledialog.

    Thanks

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels