Disable default print dialog

Posted by: Mike.Holik on 29 November 2017, 3:52 am EST

    • Post Options:
    • Link

    Posted 29 November 2017, 3:52 am EST

    Greetings,

    We are converting from ActiveReports v6 to GrapeCity ActiveReports v11. Unfortunately when our viewer is displayed, though the Print toolstrip has been removed the Print Dialog can still be reached with Ctrl-P. We want to completely disable this default print dialog so that we ONLY receive our own print dialog and not additionally this print dialog. How do we accomplish this task?

    Thanks

    you

  • Posted 29 November 2017, 4:26 pm EST

    Hello,

    Please use the following code to achieve your requirement.

    viewer1.PrintingSettings = GrapeCity.Viewer.Common.PrintingSettings.None;

    Thanks,

    Mohit

  • Posted 30 November 2017, 12:41 am EST

    Hello Mohit,

    I’ve tried your suggestion. That does hide the print dialog from being displayed but it is still being called and printing our report which is what I want to prevent as we have our own code to handle the printing.

    I want to know how to disable the print dialog entirely. In our previous version we were using (version 6) we didn’t have this issue. Of course that was many releases ago but we are hoping we still have that capability.

    Thank you

  • Posted 30 November 2017, 3:22 pm EST

    Hello,

    I would suggest to use “IMessageFilter” to achieve your requirement. Please use the “IMessageFilter” as given in following steps

    1. Attach a IMessageFilter to the Application when the form loaded.

    2. Filter the message, process the message when the message sends to the designer/viewer.

    3. Remove the filter from Application when the form close or dispose.

    Please refer the attached sample for implementing the above thing.

    Thanks,

    MohitPrintDisabled.zip

  • Posted 1 December 2017, 2:00 am EST

    Hi Mohit,

    Thanks for the quick response and the attached sample. Unfortunately, we are using ActiveReports v11 not v12 as the sample uses.

    I looked at the sample added the code to our code. Unfortunately I ran into a couple issues. First, in PreFilterMessage the code

    if ((keyData & Keys.Control) == Keys.Control && (keyData & Keys.KeyCode) == Keys.P)

    is never true (even when I do a Ctrl+P) thus that key stroke is unable to be filtered out.

    Additonally, the issue we are having is that we have a toolstrip. Included in that toolstrip is the Print ToolStripItem (index number 2 - Print). When that toolstrip item is clicked our code handles it and displays our own print dialog. Unfortunately, after that your PrintDialog is called (the print dialog itself can be hidden viewer.ReportViewer.PrintingSettings = PrintingSettings.None)

    So as you can see, your print dialog is being called without any Ctrl-P keystroke. It doesn’t do me any good to filter out the Ctrl-P because it is never there to begin with.

    Is it possible to disable your print dialog completely?

    Thank you,

    Mike

  • Posted 3 December 2017, 11:11 pm EST

    Hi Mike,

    We tried running the sample with ActiveReports11 too and the PreFilterMessage() method seems to performing fine. Could you please share the ActiveReports11 version you are using.

    Also, since you are mentioning that while you are implementing your custom Print Dialog, the default Print dialog shows up, so could you please share how exactly are you implementing a custom print dialog. Are you using the Viewer’s Print() method or something similar?

    It would be great if you could modify the uploaded sample application and share back showing the issue.

    Application can be downloaded from https://www.dropbox.com/s/q558hq2emkuh078/SRApp_Toolstrip.zip?dl=0

    Thanks,

    Ruchir Agarwal

  • Posted 5 December 2017, 7:20 am EST

    We are using ActiveReports 11.2

  • Posted 6 December 2017, 1:32 am EST

    Hi Mike,

    We too are on AR11 SP2 version. So, in order to proceed further with this case, we will need you to modify the sample we shared to replicate how exactly you are implementing custom print dialog of your own.

    Awaiting your reply.

    ~Ruchir

  • Posted 13 December 2017, 1:26 am EST

    We have a work around so nothing more at this point. Thank you for your help

Need extra support?

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

Learn More

Forum Channels