Click here to Skip to main content
16,013,489 members
Home / Discussions / C#
   

C#

 
GeneralAutomatic printing to pdf Pin
sverre.andersen14-Oct-04 0:54
sverre.andersen14-Oct-04 0:54 
GeneralRe: Automatic printing to pdf Pin
Gary Thom14-Oct-04 3:17
Gary Thom14-Oct-04 3:17 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart14-Oct-04 7:11
protectorHeath Stewart14-Oct-04 7:11 
GeneralRe: Automatic printing to pdf Pin
Gary Thom14-Oct-04 7:40
Gary Thom14-Oct-04 7:40 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart14-Oct-04 12:18
protectorHeath Stewart14-Oct-04 12:18 
GeneralRe: Automatic printing to pdf Pin
Gary Thom15-Oct-04 8:21
Gary Thom15-Oct-04 8:21 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart15-Oct-04 9:03
protectorHeath Stewart15-Oct-04 9:03 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart14-Oct-04 7:00
protectorHeath Stewart14-Oct-04 7:00 
Sure you can. You use the PrintDocument along with the Print method, which does not use the PrintDialog. You can specify the setting programmatically or read them from user settings (with defaults), which would be more appreciated by users that might need to tweak settings.

The .NET Framework SDK documentation also includes samples for using the XmlDocument class.

What's even easier is if you're embedding the WebBrowser control, you can use ExecWB to print without prompting like so:
object missing = Missing.Value;
axWebBrowser2.ExecWB(
  OLECMDID.OLECMDID_PRINT,
  OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,
  ref missing,
  ref missing);
This uses the browser's print rendering so that you don't have to - definitely something you should take advantage of if you're embedding the WebBrowser control.

You can also do something similar using the IOleCommandTarget interface with MSHTML if you're using that to render instead of dealing with the browser overhead.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: Automatic printing to pdf Pin
sverre.andersen19-Oct-04 3:01
sverre.andersen19-Oct-04 3:01 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart19-Oct-04 5:22
protectorHeath Stewart19-Oct-04 5:22 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen19-Oct-04 10:28
sverre.andersen19-Oct-04 10:28 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen21-Oct-04 0:57
sverre.andersen21-Oct-04 0:57 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart21-Oct-04 6:23
protectorHeath Stewart21-Oct-04 6:23 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen4-Nov-04 0:06
sverre.andersen4-Nov-04 0:06 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart4-Nov-04 4:55
protectorHeath Stewart4-Nov-04 4:55 
GeneralComboboxes with relations in a datagrid Pin
jalla7214-Oct-04 0:44
jalla7214-Oct-04 0:44 
GeneralRe: Comboboxes with relations in a datagrid Pin
Heath Stewart14-Oct-04 6:46
protectorHeath Stewart14-Oct-04 6:46 
GeneralRe: Comboboxes with relations in a datagrid Pin
jalla7214-Oct-04 20:04
jalla7214-Oct-04 20:04 
GeneralRe: Comboboxes with relations in a datagrid Pin
Heath Stewart14-Oct-04 20:14
protectorHeath Stewart14-Oct-04 20:14 
GeneralRe: Comboboxes with relations in a datagrid Pin
jalla7215-Oct-04 0:01
jalla7215-Oct-04 0:01 
GeneralRe: Comboboxes with relations in a datagrid Pin
Heath Stewart15-Oct-04 6:18
protectorHeath Stewart15-Oct-04 6:18 
QuestionHow to make the Form (at run time) behave like the Form (at design time) Pin
god4k14-Oct-04 0:33
god4k14-Oct-04 0:33 
AnswerRe: How to make the Form (at run time) behave like the Form (at design time) Pin
Heath Stewart14-Oct-04 6:50
protectorHeath Stewart14-Oct-04 6:50 
AnswerRe: How to make the Form (at run time) behave like the Form (at design time) Pin
Christian Wikander15-Oct-04 3:32
Christian Wikander15-Oct-04 3:32 
GeneralMoving a file over a network. Pin
Dylan van Heerden14-Oct-04 0:30
Dylan van Heerden14-Oct-04 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.