Пример #1
0
 public FileResult PDF()
 {
     var converter = new Converter { Layout = CurrentLayout };
     Converter.LastCompileException = null;
     var tex = converter.ToTex(CurrentLayout);
     //var pdf  = CompileTikZToPDF(tex);
     //if (pdf == null || pdf.Length == 0)
     //{
     //    return new FileContentResult(System.Text.Encoding.UTF8.GetBytes(LastMessage), "text/plain");
     //}
     var pdf = converter.ToPDF();
     if (Converter.LastCompileException != null)
     {
         var errorMessage = Converter.LastCompileException.Message;
         errorMessage += Environment.NewLine + Environment.NewLine + Converter.LastCompileException.StackTrace;
         return new FileContentResult(System.Text.Encoding.UTF8.GetBytes(errorMessage), "text/plain");
     }
     return new FileContentResult(pdf, "application/pdf")
     {
         FileDownloadName = "layout.pdf"
     };
 }