简体   繁体   中英

C# printing rdlc report unattended

I am working on a C# WinForm application that currently has several RDLC reports in it, and those reports need to print at a given time without any user interaction.

The good news, is I found code to do that at Printing A Local Report Without Preview

Unfortunately, while that works fairly well, when it prints, it puts up a small window saying "Printing page x of y" - is there any way to hide/suppress that window, so it can print silently while the user continues to work within the application?

Never mind - I found the solution on my own:

Turns out all you need to do is add the following line before doing the printDoc.Print in the code:

printDoc.PrintController = new StandardPrintController();

Because you are using PrintDocument you can use this solution:

How to skip the dialog of printing in printDocument.print() and print page directly?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM