using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Controls.Primitives; using System.Text.RegularExpressions; using System.Diagnostics; using System.IO; namespace CSRender { class OutputTIFF { public static string runCSRender(string resolutionNum, string outputFile, bool pageFlag, string filePage, string targetPath, string workPath) { //実行用コンソール呼び出し ProcessStartInfo processStartInfo = new ProcessStartInfo(); string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得 string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得 processStartInfo.FileName = System.IO.Path.Combine(appDirectory, "CSRender.Data", "CSRender.exe"); processStartInfo.CreateNoWindow = true; // コマンドプロンプトを非表示 processStartInfo.UseShellExecute = false; // シェル機能オフ processStartInfo.RedirectStandardOutput = true;//標準出力をリダイレクト //解像度の引数 processStartInfo.Arguments = "/D "; processStartInfo.Arguments += resolutionNum; //出力ファイル形式の引数 processStartInfo.Arguments += " /"; processStartInfo.Arguments += outputFile; processStartInfo.Arguments += " "; //必要に応じてページ引数を指定 if (pageFlag == true) { processStartInfo.Arguments += "/P \""; processStartInfo.Arguments += filePage; processStartInfo.Arguments += "\" "; } //指定ファイル processStartInfo.Arguments += "/F "; processStartInfo.Arguments += targetPath; //出力フォルダ if (workPath != "") { processStartInfo.Arguments += " /O "; processStartInfo.Arguments += workPath; } //CSRender.exeを実行 Process process = Process.Start(processStartInfo); string resuletString = process.StandardOutput.ReadToEnd(); process.WaitForExit(); process.Close(); return resuletString; } } }