Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
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 
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 
I really have...

I know how to print a plain txt file using the PrinterSettings-class. But I would like to print a HTML file.

I use this code to load and print it:
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
missing = System.Reflection.Missing.Value;

// create an instance of Internet Explorer
IWebBrowserApp wb = (IWebBrowserApp) ie;

// Navigate to the provided url
wb.Navigate("http://www.codeproject.com", ref missing, ref missing, ref missing, ref missing);

// print to default printer
ie.ExecWB(OLECMDID.OLECMDID_PRINT, OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref missing, ref missing);

// kill the instance of IE
ie.Quit();

This works, but I'm not able to choose which printer to use. The code above print directly to the default printer while I would like to decide which one to use. The PrintDialog is not an option as the user no userinteraction shall appear.

Is there a way to specify which printer to use when using "ie.ExecWB(OLECMDID.OLECMDID_PRINT, OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref missing, ref missing)"?


/sander99
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 
GeneralRe: Moving a file over a network. Pin
Colin Angus Mackay14-Oct-04 2:00
Colin Angus Mackay14-Oct-04 2:00 
GeneralRe: Moving a file over a network. Pin
Dylan van Heerden14-Oct-04 2:18
Dylan van Heerden14-Oct-04 2:18 
GeneralRe: Moving a file over a network. Pin
Colin Angus Mackay14-Oct-04 2:22
Colin Angus Mackay14-Oct-04 2:22 
GeneralRe: Moving a file over a network. Pin
Dylan van Heerden14-Oct-04 2:39
Dylan van Heerden14-Oct-04 2:39 
GeneralRe: Moving a file over a network. Pin
Colin Angus Mackay14-Oct-04 2:47
Colin Angus Mackay14-Oct-04 2:47 
GeneralRe: Moving a file over a network. Pin
Dylan van Heerden14-Oct-04 2:51
Dylan van Heerden14-Oct-04 2:51 

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.