The default printer settings have an effect when printing to another printer

Posted by: toddniec on 14 September 2017, 7:20 pm EST

    • Post Options:
    • Link

    Posted 14 September 2017, 7:20 pm EST

    [activereports_archive]I am running into a problem where some of the printer-specific settings for the default printer are affecting the output when printing to different printer.

    This is for Active Reports 10, C#, and section reports.

    My customer has a printer, an epson, that has a printer setting that indicates if the printer should leave a border (empty space, like margins) around the page.

    They have this printer set as a default printer.

    When the print a section report to a different printer, the output shifts on the page depending on wethor or not this epson printer’s border is on or off. We have to print precisely positioned text so this is causing a serious problem.

    My code to print is more-or-less like.

      SectionReport sectionReport = LoadFromDisk();
    
      DataSet dataSet = SomeFunctionThatCreatesData();
    
      sectionReport.DataSource = dataSet;
      sectionReport.DataMember = dataSet.Tables[0].TableName;
      sectionReport.Run();
      sectionReport.Document.Print(true,true,false);
    

    thanks[/activereports_archive]

  • Posted 14 September 2017, 7:20 pm EST

    [activereports_archive]Hello,

    I would suggest you to set the PrinterName to an empty string /null in order to print to any printer and not use the default printer settings.

    sectionReport.Document.Printer.PrinterName = “”;

    Thanks,

    Deepak Sharma[/activereports_archive]

  • Posted 30 November 2018, 6:00 pm EST

    Hi, I’m suffering from the same problem and ran across this post. I tried what is proposed and it does not work (meaning when I select a different printer from the PrintDialog the DefaultPageSettings still refer to the Default printer in windows and reports don’t look right when printed depending on what the default printer is). It does allow us to preview the report which we were not able to before, but printing is still a huge problem.

    We are using WinForms and your ReportViewer. Default printer in windows is a label printer which a paper size of 200x300. We use a PrintDialog and ask the user to select a printer. User selects a different printer. When dialog comes back we set arView.Document.PrinterSettings = PrintDialog.PrinterSettings. PrintDialog.PrinterSettings.DefaultPageSettings still refers to the Windows default printer and the report that should be 1 page takes about 30 pages because it is still printing to what it thinks is a page size of 200x300.

    Furthermore, If when the PrintDialog comes back I actually change the arView.Document.Printer.DefaultPageSettings.PaperSize to what it is SUPPOSED to be…it STILL uses the paper size from the default windows printer.

    When the PrintDialog comes back, how can I get the reportviewer.document to use the values from the printer that is actually selected rather than the default windows printer?

    Thanks!

Need extra support?

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

Learn More

Forum Channels