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 | string docToConvert = @"c:\users\public\test.wpd"; WordPerfect.PerfectScript objWordPerfect = new WordPerfect.PerfectScript(); objWordPerfect.AppMaximize(); objWordPerfect.Backup(0); objWordPerfect.BackupOriginalDoc(0); objWordPerfect.PerfectExpert(0); object RN = System.Reflection.Missing.Value; objWordPerfect.FileOpen(docToConvert, WordPerfect._FileOpen_Format_enum.WordPerfect_CompoundFile_FileOpen_Format); Neevia.docCreator DC = new Neevia.docCreator(); DC.doSleep(100); DC.setParameter("DocumentOutputFormat", "PDF"); DC.setParameter("DocumentOutputName", "testWP_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!!!"); } objWordPerfect.PrintTo(docToConvert, DC.newPrinterName(), "", ""); objWordPerfect.CloseNoSave(0); objWordPerfect.ExitWordPerfect(); objWordPerfect = null; RVal = DC.create(); if (RVal != 0) { MessageBox.Show("Error while creating document!!!"); } RVal = DC.stopPrinting(); if (RVal != 0) { MessageBox.Show("Error while deleting the virtual printer!!!"); } DC = null; if (RVal == 0) { MessageBox.Show("Done!!!"); } |