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 | 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); Neevia.docCreator DC = new Neevia.docCreator(); DC.doSleep(100); while ((IE.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) || (IE.Busy == true)) { DC.doSleep(100); } DC.setParameter("DocumentOutputFormat", "PDF"); DC.setParameter("DocumentOutputName", "testURL_CSHARP"); DC.setParameter("DocumentOutputFolder", @"c:\users\public\"); DC.setParameter("PDFAutoRotatePage", "All"); int RVal = DC.startPrinting(); if (RVal != 0) { MessageBox.Show("Error while creating the virtual printer!!!"); } string defPrinter = DC.getDefaultPrinter(); DC.setDefaultPrinter(DC.newPrinterName()); IE.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref RN, ref RN); RVal = DC.create(); if (RVal != 0) { MessageBox.Show("Error while creating document!!!"); } IE.Quit(); DC.setDefaultPrinter(defPrinter); RVal = DC.stopPrinting(); IE = null; DC = null; if (RVal != 0) { MessageBox.Show("Error while deleting the virtual printer!!!"); } else { MessageBox.Show("Done converting !!!"); } |