views:

817

answers:

1

From MSDN:

This method prints the current document without requiring further user input. To display the Print dialog box prior to printing, use the ShowPrintDialog method.

But when I execute .Print() in my code, I always get the normal Windows printer dialog box.

My question is simply: how do I avoid display of the printer dialog?

As an alternative, is there a better/easier way to print both HTML and PDF from within a Windows Forms application? WebBrowser does everything I need except for this problem.

Thanks, everyone.

+1  A: 

Are you requesting the right security permissions?

SecurityPermission for immediate callers to use this control. Demand value: LinkDemand; Named Permission Sets: FullTrust.

PrintingPermission to access the printer through this method. Demand value: Demand. Associated enumeration: DefaultPrinting.

jeffamaphone
Thanks, but it seems to do the same thing even when I request and obtain all permissions.
catfood
catfood