Pass windows Printer Settings to Active Report document

Posted by: mdynna on 10 December 2024, 3:40 pm EST

  • Posted 10 December 2024, 3:40 pm EST

    When viewing a report in the Preview window, the Printer Settings dialog can be displayed to modify things such as duplexing or tray settings.

    We want to give the user the option of setting the Printer Settings prior to the report running, without having to show the report in the previewer. If we display the standard .NET Printer Settings dialog box to fill the PrinterSettings object, how can we pass that to the Active Report after the report has run so that the settings are used when the report is sent to the printer?

  • Posted 11 December 2024, 4:28 am EST

    Hi Mark,

    To enable users to configure Printer Settings before running the report without displaying it in the Viewer, you can utilize the

    System.Windows.Forms.PrintDialog
    class to collect the desired settings. After the user selects their printer settings, these settings can be applied directly to the
    rpt.Document.Printer.PrinterSettings
    before initiating the print job. To facilitate this, we’ve created a custom extension, PrinterSettingExtension, that transfers the printer settings from the .NET PrinterSettings object to the ActiveReports PrinterSettings. Once the settings are applied, the report is printed using the specified configuration.

    Please refer to the attached sample where we’ve implemented an extension to copy settings between PrinterSettings objects. You can integrate a similar approach into your project. If you encounter any challenges with specific events or methods during implementation, kindly share the details with us, and we’ll assist you in providing a tailored solution.

    We hope this helps!

    Attachment: PrinterSettings.zip

  • Posted 11 December 2024, 3:08 pm EST

    Thanks. Are you able to upload the sample app with a solution compatible with Visual Studio 2019?

  • Posted 12 December 2024, 2:34 am EST

    Hi Mark,

    Sure, please refer to the attached sample compatible with Visual Studio 2019.

    Attachment: VS19_Info.zipPrinterSettings_VS19.zip

Need extra support?

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

Learn More

Forum Channels