public IBuiltFile TexToPdf(IFile source, out string consoleOutput) { BuiltFile built = null; List <string> parameters = new List <string>(); parameters.Add(String.Format("\"{0}\"", source.Path)); parameters.Add(String.Format("-output-directory=\"{0}\"", OutputDirectory)); parameters.Add("-interaction=nonstopmode"); consoleOutput = SystemHelper.ExecuteShellCommand(PDFLATEX_EXE_PATH, parameters, TimeoutMs); IEnumerable <IFile> buildFiles = SystemHelper.GetFileInfo(OutputDirectory, source.Name); Regex regex = new Regex(@"Output written on ""([^""]*)""|Output written on ([^\s]*)\s"); Match match = regex.Match(consoleOutput); if (match.Success) { string matched = String.IsNullOrEmpty(match.Groups[1].Value) ? match.Groups[2].Value : match.Groups[1].Value; built = new BuiltFile(matched, source, buildFiles); } else //fixme - consider removing { built = new BuiltFile(SystemHelper.GetFilePath(OutputDirectory, source.Name, "tex"), source); } return(built); }
public IFile Compile(string templateName, object model) { IFile source = SystemHelper.GetFileInfo(TemplateDirectory, templateName, "cstex"); string src = SystemHelper.ReadFile(source.Path); string tex = Engine.Razor.RunCompile(src, source.Name, null, model); string output = SystemHelper.GetFilePath(OutputDirectory, source.Name, "tex"); return(SystemHelper.WriteFile(output, tex)); }