1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | private void button1_Click(object sender, EventArgs e) { SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer(); IE.Visible = true; object RN = System.Reflection.Missing.Value; object URL = @"http:\\www.neevia.com"; IE.Navigate2(ref URL, ref RN, ref RN, ref RN, ref RN); docuprinter.SDK DPSDK = new docuprinter.SDK(); DPSDK.doSleep(100); while ((IE.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) || (IE.Busy == true)) { DPSDK.doSleep(100); } DPSDK.DocumentOutputFormat = "PDF"; DPSDK.DocumentOutputFolder = @"c:\users\public\"; DPSDK.DocumentOutputName = "testURL"; DPSDK.HideSaveAsWindow = true; DPSDK.DefaultAction = 1; DPSDK.ApplySettings(); string defPrinter = DPSDK.GetDefaultPrinter(); DPSDK.SetDefaultPrinter("docuPrinter"); IE.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref RN, ref RN); int RVal = DPSDK.Create(100); if (RVal != 0) { MessageBox.Show("Error while creating document!!!"); } IE.Quit(); DPSDK.SetDefaultPrinter(defPrinter); IE = null; DPSDK = null; if (RVal != 0) { MessageBox.Show("Error while deleting the virtual printer!!!"); } else { MessageBox.Show("Done converting !!!"); } } |