Printer Settings

Posted by: paulywally on 3 August 2017, 3:20 pm EST

  • Posted 3 August 2017, 3:20 pm EST


    How do I assign the printer settings to a report in the viewer when printing? Basically, they want to have a different default printer for reports of certain types.


  • Replied 3 August 2017, 3:20 pm EST


    We have our own tool bar with our own print button as well, so I was hoping it was easy to change the default printer based on the report type (like a label).

    It is a time saver that some of our users have been asking for.
  • Replied 3 August 2017, 3:20 pm EST


    You can customize the printer settings using the following piece of code:

                     using DataDynamics.Reports;
                     using DataDynamics.Reports.Rendering.Graphics;
    <div id=":13q">

                    FileInfo fileInfo = new FileInfo(Application.StartupPath + @"\..\..\Report1.rdlx");
                    ReportDefinition reportDef = new ReportDefinition(fileInfo);
                    ReportRuntime runtime = new ReportRuntime(reportDef);

                    PrintDocumentRenderingExtension renderer = new PrintDocumentRenderingExtension();
                    NameValueCollection settings = renderer.GetSupportedSettings().GetSettings();

                    // render the report using the print renderer

                    runtime.Render(renderer, null, settings);

                    // configure the PrintDocument before printing
                    PrintDocument printDocument = renderer.Document;
                    printDocument.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";

                    // set the print controller
                    printDocument.PrintController = new StandardPrintController();

    You can add this code to your print button to change the default printer depending on which report is to be printed.

    Manpreet Kaur
  • Replied 3 August 2017, 3:20 pm EST


    When you preview the report in the viewer, the toolbar displayed at the top has a print button. Clicking on the print button displays the Print Dialog, which would enable you to select a different printer for each report. You can select the printer you need from this dialog. Hope it will help you. Please let me know if you are looking for something else.

    Manpreet Kaur
  • Replied 3 August 2017, 3:20 pm EST

    Yes, I understand that. I just want it to default to something else. Is that possible programmatically?


  • Replied 3 August 2017, 3:20 pm EST

    For instance, if I print programmatically, I can set the printer settings. How can I do that with the viewer?

    NameValueCollection settings = ((IConfigurable)_renderer).GetSupportedSettings().GetSettings();

    if (_printerSettings == null)


    System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();

    if (printDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)


    _printerSettings = printDialog.PrinterSettings;


    settings["PrinterName"] = _printerSettings.PrinterName;

    _reportRuntime.Render(_renderer, null, settings);

    _renderer.Document.PrinterSettings = _printerSettings;
  • Replied 3 August 2017, 3:20 pm EST


    Unfortunately, I am still not able to understand your requirement, could you please elaborate it further. Do you want to reset the default printer to a different printer in the print dialog, when the user clicks on the print button. Please let me know what exactly are you looking for, so that I can guide you ahead in the same direction.

    Manpreet Kaur
  • Replied 11 December 2017, 12:06 pm EST


    I am having some of the same issues with a slightly different twist.

    Using Active Reports11 Print preview and Page reports, I want to use the print preview tool bar but change the default printer based on the report name.

    I have created an windows desktop form with the print preview control. I have other forms that print different documents using the form with the print preview control.

    It is a multi-user networked application with multiple network printers, 1 for invoices, 1 for reports, 1 for purchase orders, and so on. all users on the network print to the same 3 or 4 printers.

    I need to be able to somehow set the "default" printer name based on the report being printed by the print preview control. is there a way to do that with code behind the Active Reports11 Print preview toolbar print button?
Need extra support?

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

Learn More

Forum Channels